为什么我得到5.5.4无效的地址错误? [英] Why do I get 5.5.4 Invalid Address error?
本文介绍了为什么我得到5.5.4无效的地址错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用以下代码发送电子邮件:
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;
}
但是,我收到了例外:
服务器响应是:5.5.4无效地址
The server response was: 5.5.4 Invalid Address
从电子邮件,电子邮件,服务器主机名和端口都是正确的。完全相同的代码,具有完全相同的输入值在我们办公室的另一台机器上工作
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.
我的机器名称中有一个å字符(无效的瑞典字符)。改变之后,它的工作。
Turns out my machine name has an 'å'-character (invalid Swedish character) in it. After changing that, it worked.
这篇关于为什么我得到5.5.4无效的地址错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文