Sending an email with an attachement from a vb.net screen

I want to launch an email with an attachment by clicking a button on a vb.net screen.
In the OnClick event, I have the following code:
Dim EmailAddr as String = "MAILTO:SOMEBODY@SOMEWHERE.COM?Subject=Sending an attachment"
EmailAddr = EmailAddr & "&Body=Hello How are you"
EmailAddr = EmailAddr & "&Attachment='\\XXX-xxx-01\users\johndoe\DlyActvty.xls'"
System.Diagnostics.Process.Start(EmailAddr)

The Outlook email body appears with the Address, Subject, and Body properly filled in, but WITHOUT the attachment. No error message appears, and the attachment location is valid.

What is the proper syntax for sending an email with attachment, using "System.Diagnostics.Process.Start"?

I know there are alternative methods I can research, but I really need to use "System.Diagnostics.Process.Start" due to convenience and certain constraints in the system I am creating this enhancement for.

Thanks




TDIGIAAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
käµfm³d 👽Connect With a Mentor Commented:
I don't believe the mailto protocol supports attachments. (http://msdn.microsoft.com/en-us/library/aa767737%28VS.85%29.aspx | http://ftp.isi.edu/in-notes/rfc2368.txt).

The System.Net.Mail.SMTP class will allow you to send attachments. Do you have access to a SMTP server? Gmail's public server could be an option if you do not.
0
 
käµfm³d 👽Commented:
The reason I as about SMTP is that when you do a Process.Start to send mail, the system is going to launch the default email client, most likely trying to use the mailto protocol (assuming that's how you coded it). Unless your client supports some kind of command-line options for sending mail, you may be limited to using the SMTP class.
0
All Courses

From novice to tech pro — start learning today.