为什么我得到5.5.4无效地址错误? [英] Why do I get 5.5.4 Invalid Address error?

查看:307
本文介绍了为什么我得到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无效地址错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆