SMTP Exception
-
Hi All, first of all, I am extremely sorry for asking the same question again! my problem is i am trying to send an email in asp.net 2.0. But I keep on getting an exception whenever i try to send.. Here is the exception Send failure: System.Net.Mail.SmtpException: The operation has timed out. at System.Net.Mail.SmtpClient.Send(MailMessage message) at Default2.btnSubmit_Click(Object sender, EventArgs e) and here is my code: protected void btnSubmit_Click(object sender, EventArgs e) { SmtpClient smtpClient = new SmtpClient(); MailAddress objMail_From = new MailAddress("username@gmail.com"); MailAddress objMail_To = new MailAddress("username@gmail.com"); MailMessage objMail = new MailMessage(objMail_From, objMail_To); objMail.Subject = "Email-Test Example"; objMail.IsBodyHtml = true; objMail.Body = "Sending E-mails with ASP.NET 2.0 using CSharp" + "
Company : " + lblCompany1.Text + "
" + "
Address : " + lblAddress1.Text + "
" + "
Telephone :" + lblTelephone1.Text + "
" + "
Fax :" + lblFax1.Text + "
" + "
Email : " + lblEmail1.Text + "
" + "
Comments : " + lblComments1.Text + "
" + ""; objMail.Priority = MailPriority.High; smtpClient.Host = "smtp.yahoo.com"; smtpClient.Credentials = new System.Net.NetworkCredential("username@gmail.com", "xxxxxx"); smtpClient.UseDefaultCredentials = false; smtpClient.EnableSsl = true; smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network; try { smtpClient.Send(objMail); Response.Write("Your mail has been sent"); } catch (Exception exc) { Response.Write("Send failure: " + exc.ToString()); } } and in the web.config i put it like this: _________ could any one please help me on this... plz.. Thank in Advance.
-
Hi All, first of all, I am extremely sorry for asking the same question again! my problem is i am trying to send an email in asp.net 2.0. But I keep on getting an exception whenever i try to send.. Here is the exception Send failure: System.Net.Mail.SmtpException: The operation has timed out. at System.Net.Mail.SmtpClient.Send(MailMessage message) at Default2.btnSubmit_Click(Object sender, EventArgs e) and here is my code: protected void btnSubmit_Click(object sender, EventArgs e) { SmtpClient smtpClient = new SmtpClient(); MailAddress objMail_From = new MailAddress("username@gmail.com"); MailAddress objMail_To = new MailAddress("username@gmail.com"); MailMessage objMail = new MailMessage(objMail_From, objMail_To); objMail.Subject = "Email-Test Example"; objMail.IsBodyHtml = true; objMail.Body = "Sending E-mails with ASP.NET 2.0 using CSharp" + "
Company : " + lblCompany1.Text + "
" + "
Address : " + lblAddress1.Text + "
" + "
Telephone :" + lblTelephone1.Text + "
" + "
Fax :" + lblFax1.Text + "
" + "
Email : " + lblEmail1.Text + "
" + "
Comments : " + lblComments1.Text + "
" + ""; objMail.Priority = MailPriority.High; smtpClient.Host = "smtp.yahoo.com"; smtpClient.Credentials = new System.Net.NetworkCredential("username@gmail.com", "xxxxxx"); smtpClient.UseDefaultCredentials = false; smtpClient.EnableSsl = true; smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network; try { smtpClient.Send(objMail); Response.Write("Your mail has been sent"); } catch (Exception exc) { Response.Write("Send failure: " + exc.ToString()); } } and in the web.config i put it like this: _________ could any one please help me on this... plz.. Thank in Advance.
DKalepu wrote:
smtpClient.Host = "smtp.yahoo.com"; smtpClient.Credentials = new System.Net.NetworkCredential("username@gmail.com", "xxxxxx");
Gmail credentials with yahoo smtp server?:confused: You probably should use Gmail's smtp in this case.
-
DKalepu wrote:
smtpClient.Host = "smtp.yahoo.com"; smtpClient.Credentials = new System.Net.NetworkCredential("username@gmail.com", "xxxxxx");
Gmail credentials with yahoo smtp server?:confused: You probably should use Gmail's smtp in this case.
oops...... I pardon for it! that was such a silly mistake... :mad: i hv changed it to gmail smtp..it throws anoter exception now: Send failure: System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required z15sm3365130pod at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response) at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, String from) at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) at System.Net.Mail.SmtpClient.Send(MailMessage message) at Default2.btnSubmit_Click(Object sender, EventArgs e) in ------
-
oops...... I pardon for it! that was such a silly mistake... :mad: i hv changed it to gmail smtp..it throws anoter exception now: Send failure: System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required z15sm3365130pod at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response) at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, String from) at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) at System.Net.Mail.SmtpClient.Send(MailMessage message) at Default2.btnSubmit_Click(Object sender, EventArgs e) in ------