Sending an email with an attachement from a screen

Posted on 2010-01-04
Last Modified: 2012-05-08
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.


Question by:TDIGIA
    LVL 74

    Accepted Solution

    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.
    LVL 74

    Expert Comment

    by:käµfm³d 👽
    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.
    LVL 69

    Assisted Solution

    by:Éric Moreau

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
    Article by: jpaulino
    XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String ( Literal, only instead of starting and ending with w…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now