Opening email client window

  • Thread starter Thread starter Zack
  • Start date Start date
Z

Zack

I am totally new to microsoft technolgy so please bear
with me. All i want to do is to open an email client
software tool (outlook or outlook express) from inside my
application so that people could send email from within my
application. How can I do that? Please help
 
Writing your own is pretty simple....

Basically, create a form to mimic An outlook form..


//I rewrote my VB Code on the fly, might have a typo but
should work.

using System.Web.Mail

Dim m As New MailMessage //MailMessage m = new
MailMessage();
private void btnSend_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs)
m.To = tbTo.Text
m.From = tbFrom.Text
m.Subject = tbSubject.Text
m.Body = rtb.Text
System.Web.Mail.SmtpMail.Send(m)//Key Line here
this.Dispose()

YOu can also add attachments, CC support and BCC support.

Hopefully this helps. Your other alternative is to
reference the Outlook library and create an outlook
message, but if you are just starting, this is a much
easier approach.

Good Luck,

Bill
 
if you just want to use outlook\outlook express (pretty sure outlook works
with this too, don't have it on this machine to test)
this code will do it, you'll have to put a little work into filling in the
address & subject, but it will work.
System.Diagnostics.Process.Start("mailto:email@address?subject=my subject");
 
forgot to mention, in theory, that should work with any mail application
that provides a mailto app.
 
System.Diagnostics.Process.Start("mailto:email@address?subject=mysubject");

FYI - the length of a URL is limited to 255 char's. If you need to pass a
large amount of data this approach won't work.

Eric Cadwell
http://www.origincontrols.com
 
We had a contractor implement a MailItem class using a URL. It wasn't until
much later that we realized the error of our ways.

We were also passing in the body as you showed:
string.Format("mailto:{0}?Subject={1}&Body={2}", this.To, this.Subject,
this.Body);

The body parameter in our case was 1000s of chars in length.

-Eric
 
Back
Top