Email... HELP

B

blini

//create the mail message
MailMessage mail = new MailMessage();

//set the addresses
mail.From = new MailAddress("(e-mail address removed)");
mail.To.Add("(e-mail address removed)");

//set the content
mail.Subject = "This is an email";
mail.Body = "this is the body content of the email.";

//send the message
SmtpClient smtp = new SmtpClient("smtp.gmail.com");

smtp.EnableSsl = false;

//to authenticate we set the username and password
properites on the SmtpClient
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Credentials = new
NetworkCredential("gmailLogin","gmailPassword","localhost");
smtp.Send(mail);


it´s ok??
why it does not send the email??
 
Y

Yama

Put a breakpoint on the line you create a new instance of SmtpClient and
check what is missing...


//create the mail message
MailMessage mail = new MailMessage();

//set the addresses
mail.From = new MailAddress("(e-mail address removed)");
mail.To.Add("(e-mail address removed)");

//set the content
mail.Subject = "This is an email";
mail.Body = "this is the body content of the email.";

//send the message
SmtpClient smtp = new SmtpClient("smtp.gmail.com");

smtp.EnableSsl = false;

//to authenticate we set the username and password
properites on the SmtpClient
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Credentials = new
NetworkCredential("gmailLogin","gmailPassword","localhost");
smtp.Send(mail);


it´s ok??
why it does not send the email??
 

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

Similar Threads


Top