Thanks a lot.
Bu i can't test immediately. After the test, i'll return a message to group.
"Juan T. Llibre" <no***********@nowhere.com> wrote in message news:%2****************@TK2MSFTNGP15.phx.gbl...
As you can see, there's no classes in system.web.mail
which allow for sender authentication :
.Net Framework 1.1 :
http://www.csharpfriends.com/quickst...ystem.Web.Mail
.Net Framework 2.0 :
http://beta.asp.net/quickstart/util/...ystem.Web.Mail
However, you can *add the authentication schemas* :
private void Page_Load(object sender, System.EventArgs e)
{
MailMessage mail = new MailMessage();
mail.To = "so******@mail.someserver.com";
mail.From = "yo*@mail.server.com";
mail.Subject = "this is the subject.";
mail.Body = "this is the body";
//add schema for basic authentication
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
// if you want NTLM authentication, use "2" !
//set the username
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "the_username");
//set the password
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "the_password");
//your mail server's name goes here
SmtpMail.SmtpServer = "mail.server.com";
// finally, send the user-authenticated mail
SmtpMail.Send(mail);
}
---000---
Check it out, and let me know if that works for you.
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
"aslantifosi" <al***********@invenoa.com> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl...
hi all,
My question is about that i use a smpt server which is running on a
different machine from my webserver machine. And i can authenticate with a
user and password. I use SmtpMail class. i set the smtpserver property. but
how can i authenticate with my user and pass?
for ex:
my user :xx**@xxx.com
pass :12345
Message.From = myuser;
Message.To=strTo;
Message.Subject=strSubject;
Message.Body = strBody;
try
{
SmtpMail.SmtpServer = "172.19.1.123";
SmtpMail.Send(Message);
}
catch(System.Web.HttpException ehttp)
{
}