473,326 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

SMTPMAIL

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)

{

}

Nov 19 '05 #1
3 1537
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)

{



}


Nov 19 '05 #2
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)

{



}


Nov 19 '05 #3
I can verify that your suggestion works. I've had it going for several months with no problems.

-Frankie
"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)

{



}


Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Jason | last post by:
Hi just a really quick simple question. Can you configure SmtpMail class in C# to use a different port? or does it have to be port 25? Thanks Jason
2
by: Leszek | last post by:
Hello, I have created a simple code to send emails using the MailMessage class and the SmtpMail.Send() method: MailMessage mail = new MailMessage(); mail.From = echidna@somewhere.com; //...
5
by: ElanKathir | last post by:
Hi ! I wrote one code for Send the E-mail, But that code have some problem , So please help me Here i paste my code and Error: Error: Server Error in '/Elan_Sample' Application. ...
2
by: Edward | last post by:
Hello, everybody, I tried to send Email out using ASP.NET, but failed, here is the code of sending: -------------------------------------------------------------------------------- Try...
1
by: Jens Øster | last post by:
Hi I am writing a ASP.NET web application that must sent some e-mails. I get the exception “Could not access 'CDO.Message' object†when I call SmtpMail.Send. This only happens when I send...
3
by: Jens | last post by:
Hi I am writing a ASP.NET web application that must sent some e-mails. I get the exception “Could not access 'CDO.Message' object†when I call SmtpMail.Send. This only happens when I send...
4
by: Aren Cambre | last post by:
Why does SmtpMail.Send throw an exception if the MailMessage's BodyFormat = MailFormat.Html? I've searched all over the place and cannot find a solution anywhere. I am running this on Windows XP...
2
by: kmbarz | last post by:
I'm trying to expand my horizons here by working through an ASP.Net book. When I do the example that uses: Line 55: Mail.From = "feedback@graymad.com" Line 56: ...
19
by: zdrakec | last post by:
Hello all: Using an "Imports System.Web.Mail" clause at the head of my module, and after executing the following code: Dim msg As New MailMessage msg.From = sender msg.To = recipient...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.