本文介绍了为什么我得到5.5.4无效地址错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试着用下面的code发送电子邮件:
I tried to send an email using the following code:
MailMessage message = new MailMessage(); message.From = new MailAddress(fromMailAddress.Trim()); message.To.Add(new MailAddress(toMailAddress.Trim())); message.Subject = subject; message.Body = body; message.SubjectEncoding = System.Text.Encoding.UTF8; message.BodyEncoding = System.Text.Encoding.UTF8; SmtpClient client = new SmtpClient(); try { client.Send(message); } catch(Exception e) { throw e; }不过,我得到了异常:
However, I got the exception:
服务器响应为:5.5.4无效的地址
The server response was: 5.5.4 Invalid Address
从该邮件,电子邮件,服务器的主机名和端口是正确的。完全相同的code,具有完全相同的输入值的工作另一台机器上在我们的办公室
The from email, to email, server host name and port are all correct. The exact same code, with exact same input values works on another machine in our office
推荐答案找到了一些彻底的调试后,问题的答案。
Found out the answer after some thorough debugging.
原来我的机器的名字中有一个'A'字符(无效字符瑞典)。改变这之后,它的工作。
Turns out my machine name has an 'å'-character (invalid Swedish character) in it. After changing that, it worked.
更多推荐
为什么我得到5.5.4无效地址错误?
发布评论