Emailing From a Windows Application

  • Thread starter Thread starter John Smith
  • Start date Start date
J

John Smith

Hey folks,

I've got a C# Windows application that needs the ability to send emails. It
should behave the same way as when you click on a mailto link through a web
browser (i.e. open up the user's default mail client and start a new email).

How would I do that in a Windows C# application? It must be compatible with
Outlook 97-2003.

Thanks a lot!
 
John, take a look at the System.Web.Mail namespace. It contains all the
classes you need, and you can use them in Windows forms apps as well.

--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Thx. Actually though, everything I've read states that the System.Web.Mail
Namespace can not open your default mail client and behave like the mailto
link.

I did find what I was looking for though. For all you future google
searchers:
System.Diagnostics.Process.Start(string.Format("mailto:{0}?Subject={1}&Body=
{2}", "(e-mail address removed)", "Me Subject", "Me Body"));

Thanks for the help though Kai.


Kai Brinkmann said:
John, take a look at the System.Web.Mail namespace. It contains all the
classes you need, and you can use them in Windows forms apps as well.

--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


John Smith said:
Hey folks,

I've got a C# Windows application that needs the ability to send emails.
It
should behave the same way as when you click on a mailto link through a
web
browser (i.e. open up the user's default mail client and start a new
email).

How would I do that in a Windows C# application? It must be compatible
with
Outlook 97-2003.

Thanks a lot!
 
Sorry to hijack the thread, but just a couple of questions... I tried using
the System.Web.Mail namespace, and found it to work, but with a couple of
reservations: it only worked on a PC that had IIS (with SMTP) installed, and
setting the SmtpServer property beforehand had no effect (I was curious to
see this is a static method!?). If I stopped IIS, then the SendMail didn't
throw an exception, but the mail never got there - but it then came through
when I started the IIS server again!
Is there any pointers on how to do it operating off the SMTP server of a
remote machine running IIS?

Kai Brinkmann said:
John, take a look at the System.Web.Mail namespace. It contains all the
classes you need, and you can use them in Windows forms apps as well.

--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


John Smith said:
Hey folks,

I've got a C# Windows application that needs the ability to send emails.
It
should behave the same way as when you click on a mailto link through a
web
browser (i.e. open up the user's default mail client and start a new
email).

How would I do that in a Windows C# application? It must be compatible
with
Outlook 97-2003.

Thanks a lot!
 
Back
Top