The error says you need to authenticate. I do not see any username/password in your code. Make sure your web.config file has the neccessary credentials if you aren't going to put them in your code.
Reporting by definition is different. Otherwise we would just show it on the screen.
Thanks. I added the credientials to my webconfig file and I am now getting this error;
The specified string is not in the form required for an e-mail address. on this line:
System.Net.Mail.MailMessage
eMail = new
System.Net.Mail.MailMessage();
Also is there a way to get by without adding my email password in the webconfig file? I may not be the
only person accessing that page and dont want my password for anyone else to see. Any ideas on that?
Thanks. I added the credientials to my webconfig file and I am now getting this error;
The specified string is not in the form required for an e-mail address. on this line:
System.Net.Mail.MailMessage
eMail = new
System.Net.Mail.MailMessage();
Also is there a way to get by without adding my email password in the webconfig file? I may not be the
only person accessing that page and dont want my password for anyone else to see. Any ideas on that?
Hi gordon1221,
The problem in this case is not in the page itself, but rather in web.config. This configuration file has a<system.net /> element that enables you to store information about the mail server and the from account. If you make a mistake in the from attribute
and enter an invalid e-mail address you get this error. The following article gives a solution about how to handle it, please try to refer to:
http://imar.spaanjaars.com/499/how-to-handle-the-error-the-specified-string-is-not-in-the-form-required-for-an-e-mail-address .
Thanks,
Amy Peng
Please mark the replies as answers if they help or unmark if not.
Feedback to us
gordon1221
Member
12 Points
117 Posts
Send Email Error
Dec 13, 2012 03:26 PM|LINK
I am trying to send an email when the user hits submit. This is the error I am receiving:
"Syntax error, command unrecognized. The server response was: 5.0.0 Your email system must authenticate before sending mail: XM_ERR:131.187.253.226"
Here is my code:
public
void SendMail(string FromEmail, string ToEmail, string Subject, string Body)
{
System.Net.Mail.MailMessage eMail = new System.Net.Mail.MailMessage();
eMail.From =new System.Net.Mail.MailAddress(FromEmail);
eMail.To.Add(ToEmail);
eMail.Subject = Subject;
eMail.IsBodyHtml =true;
eMail.Body = Body;
SmtpClient SMTP = new SmtpClient("mail.authsmtp.com");
//SMTP.Port = 25;
//SMTP.Host = "mail.authsmtp.com";
SMTP.Send(eMail);
eMail.Dispose();
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
StringBuilder sbBody = new StringBuilder();
string FromEmail = lxxxx@fromemail.com;
string ToEmail = xxx@test.com;
string Subject = "Application for" + " " + txtFirstName.Text + " " + txtLastName.Text + " " + "created on:" + " " + txtDateCreated.Text;
sbBody.Append("Click link below to view application for" + " " + txtFirstName.Text + " " + txtLastName.Text);
sbBody.Append("<br/>");
sbBody.Append("<br/>");
sbBody.Append(Display.aspx?ID=@ID);
sbBody.Append("<br/>");
sbBody.Append("Thank you,");
ClearControls(Page);
Response.Redirect("ThankYou.aspx");
}
ryanbesko
Contributor
3561 Points
619 Posts
Re: Send Email Error
Dec 13, 2012 03:30 PM|LINK
The error says you need to authenticate. I do not see any username/password in your code. Make sure your web.config file has the neccessary credentials if you aren't going to put them in your code.
gordon1221
Member
12 Points
117 Posts
Re: Send Email Error
Dec 14, 2012 03:04 PM|LINK
Thanks. I added the credientials to my webconfig file and I am now getting this error;
The specified string is not in the form required for an e-mail address. on this line:
System.Net.Mail.MailMessage eMail = new System.Net.Mail.MailMessage();
Also is there a way to get by without adding my email password in the webconfig file? I may not be the only person accessing that page and dont want my password for anyone else to see. Any ideas on that?
coder_s_a
Member
59 Points
39 Posts
Re: Send Email Error
Dec 14, 2012 03:09 PM|LINK
you can add a group email address.
And check the email properly. It seems that the email is not in correct format.
gordon1221
Member
12 Points
117 Posts
Re: Send Email Error
Dec 14, 2012 04:09 PM|LINK
The email address format is correct.
string FromEmail = "lxxxx@fromemail.com";
string ToEmail = "xxx@test.com";
andri745
Member
163 Points
73 Posts
Re: Send Email Error
Dec 14, 2012 05:14 PM|LINK
You need to set up the Credentials property into SmtpClient :
MailMessage m = new MailMessage(); [...] SmtpClient smtp = new SmtpClient(); smtp.Credentials = new System.Net.NetworkCredential("user", "pass");--
Blog
Microsoft MCPD - Web Developer .NET 4
RameshRajend...
Star
7983 Points
2099 Posts
Re: Send Email Error
Dec 14, 2012 05:24 PM|LINK
Hai
Check the same issue answers
http://forums.asp.net/t/1059857.aspx/1
http://forums.asp.net/t/1130848.aspx/1
http://forums.asp.net/t/1337904.aspx/1
http://forums.asp.net/t/1181680.aspx/1
Amy Peng - M...
Star
10198 Points
964 Posts
Microsoft
Re: Send Email Error
Dec 17, 2012 04:34 AM|LINK
Hi gordon1221,
The problem in this case is not in the page itself, but rather in web.config. This configuration file has a<system.net /> element that enables you to store information about the mail server and the from account. If you make a mistake in the from attribute and enter an invalid e-mail address you get this error. The following article gives a solution about how to handle it, please try to refer to: http://imar.spaanjaars.com/499/how-to-handle-the-error-the-specified-string-is-not-in-the-form-required-for-an-e-mail-address .
Thanks,
Amy Peng
Feedback to us
Develop and promote your apps in Windows Store
bhushan_bhar...
Participant
1508 Points
581 Posts
Re: Send Email Error
Dec 17, 2012 07:22 AM|LINK
have look this link
http://usingaspdotnet.blogspot.in/2011/03/email-using-aspnet.html
Regards
Bharat Bhushan
Useofasp.net/
Howtouseasp.net