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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening an Email window.

Status
Not open for further replies.

qwert231

Programmer
Sep 4, 2001
756
0
0
US
I have a WinForm that I would like to start a New Email window (Outlook) and fill in the body and subject. Any quick pointers?
 
System.web.mail namespace

Using the classes in this namespace you can create and send emails. You may need to design an email form if you want the user to view and have input to the email before it is sent.

For example:

dim msg as new MailMessage
dim server as SmtpMail
msg.from="Sender@address.com"
msg.to="Recipient@address.com"
msg.subject="a subject"
msg.body="Some text"
server.smtpserver="mail.myserver.com"
server.send(msg)
 
Of course, if you want to use the actual Outlook mail window (or default mail client window), create a button or whatever and make it do this:

System.Diagnostics.Process.Start("mailto://user@isp.com")

That will trigger the same way as html's "mailto" link... the default mail client opens with a new message window.

Ben

"If thine enemy offend thee, give his child a drum." - Anonymous
 
Oh, didn't see you wanted to fill in the body and subject... sorry about that. kmcdonag's solution would probably be better, because it sounds like you're automating the mail.

Ben

"If thine enemy offend thee, give his child a drum." - Anonymous
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top