PDA

Click to See Complete Forum and Search --> : Sending mail using SMTP server


mmary
Feb 10th, 2007, 05:30 AM
hiiiiiiiiiii,
i was written the code like that,

string from = "marymicheal@gmail.com";
string to = "mmary.cdtech@gmail.com";
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.

JenniferBabe
Feb 12th, 2007, 07:51 AM
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.

MailMessage EMail = new MailMessage();
EMail.To = "To@yahoo.com";
EMail.From = "From@yahoo.com";
EMail.Subject = "Subject@yahoo.com";
EMail.Body = "Body";
SmtpMail.SmtpServer = "127.0.0.1"; // specify your smtp server here.
try
{
SmtpMail.Send(EMail);

}
catch(Exception) {}


Hope this helps... Jennifer

Bombdrop
Feb 13th, 2007, 07:00 AM
That a look at the following sending mail via Gmail Article (http://www.codeproject.com/useritems/SendMailUsingGmailAccount.asp)

Hope this helps!!! :thumb: :wave: :thumb: