I'm wanting to include in my WinForms app the ability to send an email.

Is it possible, and what is method to take, to send email from within a
forms app, ideally using the user's mail account. What I would like to
avoid is having to setup special mail servers/SMTP servers. If their
Outlook Express client can send mail, can I a stuff message through that
connection?

Currently if I do this:

Dim msg As New MailMessage
With msg
.To = "name@domain.com"
.From = "My App"
.Subject = "My Subject"
.Body = "My Body"
.BodyFormat = MailFormat.Text
End With
SmtpMail.SmtpServer = "MachineName"
SmtpMail.Send(msg)


....I get a Could not access 'CDO.Message' object. error.

Many thanks everyone.

--
===
Phil
(Auckland | Aotearoa)

RE: Sending Mail from a WinForms client by v-jetan

v-jetan
Mon Nov 08 03:08:30 CST 2004

Hi Phil,

Normally, setting SmtpServer property to the local machine name means that
you wanted to use the smtp service of the local machine, so you have to
config the smtp service in "Internet Information Services" tool in control
panel.

For Outlook Express, it actually connects to the remote smtp server and
leverage the smtp service of that mail server. So we may set the
SmtpMail.SmtpServer property to the same smtp server as Outlook express.
Also, many smtp server may need some schema information to authenticate the
smtp request, so we should set the username and password for that server in
the schema information, for more information about how to set the schema,
please refer to:
"SMTP Authentication using System.Web.Mail (CDOSYS)"
http://www.codeproject.com/dotnet/SystemWeb_Mail_SMTP_AUTH.asp
=============================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.


Re: Sending Mail from a WinForms client by Herfried

Herfried
Mon Nov 08 06:43:45 CST 2004

"Phil Jones" <phil_newsgroup@hotmail.com> schrieb:
> Currently if I do this:
>
> Dim msg As New MailMessage
> With msg
> .To = "name@domain.com"
> .From = "My App"
> .Subject = "My Subject"
> .Body = "My Body"
> .BodyFormat = MailFormat.Text
> End With
> SmtpMail.SmtpServer = "MachineName"
> SmtpMail.Send(msg)
>
>
> ....I get a Could not access 'CDO.Message' object. error.

<URL:http://www.systemwebmail.net/>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Re: Sending Mail from a WinForms client by Phil

Phil
Mon Nov 08 15:18:16 CST 2004

Thanks Jeffrey - as always - your answers are most helpful.

Cheers!

--
===
Phil
(Auckland | Aotearoa)



Re: Sending Mail from a WinForms client by Phil

Phil
Mon Nov 08 15:17:39 CST 2004

Are wicked Herfried! I love it when people put these kinds of FAQ's
together. Many thanks!



Re: Sending Mail from a WinForms client by v-jetan

v-jetan
Mon Nov 08 20:41:47 CST 2004

Hi Phil,

Thanks for your sweet feedback :-)! You are welcome!

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.