Sending mail using SMTP server
hiiiiiiiiiii,
i was written the code like that,
string from = "[email protected]";
string to = "[email protected]";
string subject = "testing";
string body = "smtp tested";
MailMessage message = new MailMessage(from, to, subject , body);
SmtpClient emailClient = new SmtpClient("smtp.gmail.com", 587);
System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential("ssssssss","yyyyyyy");
emailClient.UseDefaultCredentials = false;
emailClient.Credentials = SMTPUserInfo;
emailClient.Send(message);
textBox1.Text = "Message Sent";
i got the error message "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first 36sm6260958nza".
if anybody know how to rectify the problem. plz reply.
Re: Sending mail using SMTP server
I tried this sometime ago and was getting similar problems. Seems that GMail have authentication on their SMTP server. Try this, last time i tested it, it worked, and i was using the 1.0 framework.
Code:
MailMessage EMail = new MailMessage();
EMail.To = "[email protected]";
EMail.From = "[email protected]";
EMail.Subject = "[email protected]";
EMail.Body = "Body";
SmtpMail.SmtpServer = "127.0.0.1"; // specify your smtp server here.
try
{
SmtpMail.Send(EMail);
}
catch(Exception) {}
Hope this helps... Jennifer
Re: Sending mail using SMTP server
That a look at the following sending mail via Gmail Article
Hope this helps!!! :thumb: :wave: :thumb: