|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Is there a simple way to email?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.. <jimmy***@gmail.com> wrote in message
Show quoteHide quote news:1141025370.424976.237370@z34g2000cwc.googlegroups.com... In J# (VB should be very similar) :-> 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.. 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); } 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 :( 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. Show quoteHide quote news:1141027728.624772.121120@i39g2000cwa.googlegroups.com... > 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 :( > 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 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. That's true. FYI: even the MAPI ActiveX objects trigger Outlook's Object
Model Guard (at least in Outlook 2003).... which is annoying! Show quoteHide quote "adjo" <adgn***@gmail.com> wrote in message news:1141082691.675619.206210@p10g2000cwp.googlegroups.com... > 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. >
Did we lose the RadioCheck property on menuitems
Webapplications quits without matter in ASP.NET 2.0 List.Add method overwriting collectionbase? What is Instrumentation? Help please Creating web page of links and content i love reflection:) Listbox controls Ado.net to excel ? Perfomance test NEWBIE question |
|||||||||||||||||||||||