Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending emails with attachment 2

Status
Not open for further replies.

sacsac

Programmer
Dec 10, 2000
182
GB
I am successfully sending emails from VB2010, using the default email client, with the following code:

System.Diagnostics.Process.Start("mailto:me@mydomain.com?body=MyText&subject=MySubject")

Is there a way of also including an attachment?
 

MailTo doesn't support attachements.

You can use the smtp client do send mail directly from VB with attachmmts.

Perrin
 
Thanks Kliot. I have tried the smtp client, but the help indicates that it is not available for VB. Am I missing something here?
 
Kliot - sorry, I am having a brainstorm! The smtp client works just fine!
 
>MailTo doesn't support attachements

This is not entirely true. It depends on the URL resolver of the client software that is decoding the MailTo URL. MailTo supports the concept and inclusion of headers. Although generally the only headers that you can guarantee the URL resolver to understand are the "subject" and "body" headers, some clients happily accept "attach" or "attachment" as one of those headers (amongst others, such as CC, and BCC).

 
Thanks Strongm. It's a pity that using MailTo is mail client dependent with regard to the result! Certainly the smtp client (from Kliot's reply) method seems to be working just fine,so I suppose that this is the safest way of working to ensure compatibility for all users.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top