Sending Mail from a WinForms client

P

Phil Jones

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 = "(e-mail address removed)"
.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.
 
J

Jeffrey Tan[MSFT]

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.
 
H

Herfried K. Wagner [MVP]

Phil Jones said:
Currently if I do this:

Dim msg As New MailMessage
With msg
.To = "(e-mail address removed)"
.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/>
 
P

Phil Jones

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

Jeffrey Tan[MSFT]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top