I'm trying to send an email when the user submit a form. But I'm getting this error.
The funny part is that I dont get this error when I run it in the localhost, but when I publish it to the server is when it gives me this error. I have try everything without luck. Please, I need someones help badly. Here is the code:
MailMessage eMail =new MailMessage(); eMail.From =new MailAddress("myusername@dotnet.itags.org.server.net","Name"); eMail.Subject ="Subject"; eMail.Body ="Test"; eMail.To.Add("username@dotnet.itags.org.server.net"); SmtpClient client =new SmtpClient(ConfigurationManager.AppSettings["SMTPServer"], Convert.ToInt32(ConfigurationManager.AppSettings["SMTPPort"])); NetworkCredential NTLMAuthentication =new NetworkCredential("username","password","Domain"); client.UseDefaultCredentials =false; client.Credentials = NTLMAuthentication; client.Send(eMail);
Thanks in advance![]()
Which version of ASP.NET are you using?
Try putting a try...catch around the affected code and in the catch display (or write to a log) not only the main exception and any inner exception(s).
Hi erickme,
It seems AJAX problem. Do you install AJAX and use it? At least, it's server problem.
Thanks.
No luck.
I tried the try and catch, but it keeps giving me the same error message.
This is what I found out about that the 500 code means:
500 - Syntax error, command unrecognizedThis may include errors such as command line too longReally I don't see any syntax error. I'll keep trying.
Hi erickme,
500 means server error. That's to say, the request was not completed. The server met an unexpected condition.
So I think it's related to smtp.
First, I should make sure that in the first post you gave, are those red parameters(such asmyusername@.server.net","Name) true or just replacement regarding to other reasons.
If it's the real code, then it must be the problem, because there is no such server and domain.
If it's just a replacement, then I think it may be configuration problem about smtp server. You should make sure that your smtp server is running correctly, without any problem, including port access, privilege and so on.
Hope this helps. Thanks.
Thanks for all your answers. The error was in other place when I was getting the last id I posted. I already figured out, thanks anyway.
Sorry![]()
0 comments:
Post a Comment