By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,783 Members | 1,347 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,783 IT Pros & Developers. It's quick & easy.

If outgoing server requires authentication?

P: n/a
If outgoing server requires authentication,

How can I use smtpmail object in c# ?

I use a windows 2003 server hosting packet somewhere...
string from = "re******@xxx.com";
string to = UserEMail;
string subject = "Subject";
string body = "Test";
SmtpMail.SmtpServer = "smtp.xxx.com";
SmtpMail.Send(from, to, subject, body);
May 20 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Most of the smarter stmp servers dont allow relays, instead they expect
userid and password for sending particular email. Unfortunately .Net Mail
namespace doesn't provide any of such funcationality, so how we are going to
send emails in case where the stmp requires authentication. The answer lies
in the new property of Mail Message namely 'Fields' which you can find in
Framwork 1.1. You can use fields property of mailmessage like this to provide
credentials

mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1") 'basic authentication

mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "my_username_here") 'set your username here

mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "super_secret") 'set your password here
"Coder" wrote:
If outgoing server requires authentication,

How can I use smtpmail object in c# ?

I use a windows 2003 server hosting packet somewhere...
string from = "re******@xxx.com";
string to = UserEMail;
string subject = "Subject";
string body = "Test";
SmtpMail.SmtpServer = "smtp.xxx.com";
SmtpMail.Send(from, to, subject, body);

May 21 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.