Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

send email

$
0
0

hi

i use this code for send email :

MailMessage mail = new MailMessage();
        mail.To.Add("xxx@live.com");
        mail.To.Add("xxx@live.com");
        mail.From = new MailAddress("xxx@live.com");
        mail.Subject = "Email using Gmail";

        string Body = "Hi, this mail is to test sending mail" +"using Gmail in ASP.NET";
        mail.Body = Body;
        SmtpClient smtp = new SmtpClient();
        smtp.Host = "smtp.live.com";
        smtp.Port = 587;
        smtp.UseDefaultCredentials = false;
        smtp.Credentials = new System.Net.NetworkCredential
        ("xxx@live.com", "xxx");
        smtp.EnableSsl = true;
        smtp.Send(mail);

but i get erorr :

Failure sending mail.

please help  me

tganks

 


Viewing all articles
Browse latest Browse all 23244

Trending Articles