Connecting Tech Pros Worldwide Help | Site Map

Is there a simple way to email?

jimmy84c@gmail.com
Guest
 
Posts: n/a
#1: Feb 27 '06
Hi all,

Just hit a brick wall trying to learn vb.net... I need a simple way to
send an email with attachments. In VBA for MS Access, SendObject worked
perfectly. Is there an equivalent?

I can't use direct SMTP because I can't predict how each client's email
system will be set up (e.g. some using exchange, lotus notes, etc etc).

And I can't use anything specific to one email client, incase they
change clients from lotus to outlook - then I would have to reprogram
etc etc..

Is there any simple way just like SendObject???

Thanks for your time..

Homer J Simpson
Guest
 
Posts: n/a
#2: Feb 27 '06

re: Is there a simple way to email?



<jimmy84c@gmail.com> wrote in message
news:1141025370.424976.237370@z34g2000cwc.googlegr oups.com...[color=blue]
> Hi all,
>
> Just hit a brick wall trying to learn vb.net... I need a simple way to
> send an email with attachments. In VBA for MS Access, SendObject worked
> perfectly. Is there an equivalent?
>
> I can't use direct SMTP because I can't predict how each client's email
> system will be set up (e.g. some using exchange, lotus notes, etc etc).
>
> And I can't use anything specific to one email client, incase they
> change clients from lotus to outlook - then I would have to reprogram
> etc etc..
>
> Is there any simple way just like SendObject???
>
> Thanks for your time..[/color]

In J# (VB should be very similar) :-

import System.Net.Mail.*;

private void btnSend_Click(Object sender, System.EventArgs e)
{
MailAddress myTo = new MailAddress(toaddress);
MailAddress myFrom = new MailAddress(fromaddress);
MailMessage myMessage = new MailMessage(myFrom, myTo);
myMessage.set_Body("This is the body");
myMessage.set_Subject("This is the subject");
SmtpClient myClient = new SmtpClient("smtp.server.net");
myClient.Send(myMessage);
}


jimmy84c@gmail.com
Guest
 
Posts: n/a
#3: Feb 27 '06

re: Is there a simple way to email?


Thanks for such a fast response! But I don't want to use SMTP for
countless reasons - just want to launch the default email program on
the system, and create a new message (with attachments), which pops up
ready for the user to click "Send".

Just like using "mailto:" - but the problem is that mailto doesn't
support attachments :(

CMM
Guest
 
Posts: n/a
#4: Feb 27 '06

re: Is there a simple way to email?


AFAIK the only way to do this by using the MAPI ActiveX objects. This is
exactly what they were made for.
http://activex.microsoft.com/controls/vb6/MSMAPI32.CAB
If the user's mail program respects the MAPI API, it'll do what you want.
Both Outlook and Outlook Express both work fine... as does AOL Mail from
what I remember. Not sure about the new guys like Thunderbird. It's easy to
experiment.

--
-C. Moya
www.cmoya.com

<jimmy84c@gmail.com> wrote in message
news:1141027728.624772.121120@i39g2000cwa.googlegr oups.com...[color=blue]
> Thanks for such a fast response! But I don't want to use SMTP for
> countless reasons - just want to launch the default email program on
> the system, and create a new message (with attachments), which pops up
> ready for the user to click "Send".
>
> Just like using "mailto:" - but the problem is that mailto doesn't
> support attachments :(
>[/color]


Cor Ligthert [MVP]
Guest
 
Posts: n/a
#5: Feb 27 '06

re: Is there a simple way to email?


Jimmy,

No there is no simple way, the only alternative for SMTP is maybe (I never
tried it or saw it in VBNet) is the way as Carlos (CMM) shows.

The attachment is not a standard option from the standard mailclient.

If it is inside an organisation which uses Office Outlook than interop can
be the alternative, as well not the simple way.

Does not help however at least to search to deep.

Cor


adjo
Guest
 
Posts: n/a
#6: Feb 27 '06

re: Is there a simple way to email?


When you decide to use Outlook then you can expect to have some trouble
sending mail because of Microsofts security policy. Search for
'redemption' to find out how to be able to do your mailstuff without
the annoying blocking.

CMM
Guest
 
Posts: n/a
#7: Feb 28 '06

re: Is there a simple way to email?


That's true. FYI: even the MAPI ActiveX objects trigger Outlook's Object
Model Guard (at least in Outlook 2003).... which is annoying!

--
-C. Moya
www.cmoya.com
"adjo" <adgnews@gmail.com> wrote in message
news:1141082691.675619.206210@p10g2000cwp.googlegr oups.com...[color=blue]
> When you decide to use Outlook then you can expect to have some trouble
> sending mail because of Microsofts security policy. Search for
> 'redemption' to find out how to be able to do your mailstuff without
> the annoying blocking.
>[/color]


Closed Thread