access new mail in default mail client in vb.net

Joined
Feb 21, 2005
Messages
9
Location
Wisconsin
Programming Experience
10+
I need to have my vb.net application open the client's default mail client (it may not be Outlook), and launch "new mail". The "to address", "subject" and attachment(s) will need to be passed to the new mail automatically. The user can then enter in the email body and click on send email button. I've found on the internet how I can email to the default mail client behind the scenes. But, nothing on how to launch the mail client and open the "new email" interface (as well as pass information to it). Is this possible? If so, any information you can give me on this would be appreciated. Thanks!
 

suddenelfilio

Well-known member
Joined
Jun 3, 2004
Messages
144
Location
Belgium
Programming Experience
5-10
a possibility would be by looking for the command line arguments for the most commonly used mail clients and implement them, perhaps use an interface to provide extensibility for the future.
 

MNeb

Member
Joined
Feb 22, 2005
Messages
21
Programming Experience
1-3
From your post you have these requirements:
1. Get a new blank email from the user's default email program.
2. Populate the To address.
3. Populate the Subject.
4. Add any attachments.

You can do 1-3 easily without knowing what the default email program is. How you do it is this (air code, check for missing parameters):
system.diagnostics.process.start("mailto:" & toaddress & "?subject=" & subject)

I may have typed that wrong, since I do not have VB.Net on this computer. But do a google search for mailto.

The only way to add attachments is by figuring out what the user uses for their default email program (option dialog?) and using late-binding objects.
 

Vardoj

New member
Joined
Mar 15, 2005
Messages
1
Programming Experience
Beginner
Similar problem

I'm having a similar situation. I have an Access form which contains a textbox control that stores an email address. I'm trying to code the double-click event of the textbox to launch the default email client and populate the To: field with the value of textbox.text. I have googled it and found only a couple of examples and neither of them worked.
 
Joined
Feb 21, 2005
Messages
9
Location
Wisconsin
Programming Experience
10+
Vardoj -- I was able to find something that helped me open the default mail app and auto-populate the To Address, Subject and Body --- and then allow the operator to change fonts, etc before pressing Send Email button. http://www.freevbcode.com/ShowCode.Asp?ID=5351


Hope this helps you.

Now I just need to find out how to automatically attach documents to it.
 
Top Bottom