Sending an email with an attachement from a screen

I want to launch an email with an attachment by clicking a button on a 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'"

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.


Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

käµfm³d 👽Connect With a Mentor Commented:
I don't believe the mailto protocol supports attachments. ( |

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.
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.
All Courses

From novice to tech pro — start learning today.