ali raza

C#, .Net , and my thoughts

how to send mail smtp with authentication with web.mail class

hi i used following code

MailMessage message = new MailMessage();

message.To = "";

message.From = "";
message.Subject = "Testing Internet SmtpMail";
message.BodyFormat = MailFormat.Html;

message.Body = "body";

message.Fields.Add("", "");
message.Fields.Add("", 25);
message.Fields.Add("", 2); //2 to send using SMTP over the network
message.Fields.Add("", 1); //1 = basic authentication
message.Fields.Add("", "username");
message.Fields.Add("", "password");

catch (Exception e)
// trap here

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: