为什么我得到5.5.4无效地址错误?

编程入门 行业动态 更新时间:2024-10-25 19:20:56
本文介绍了为什么我得到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无效地址错误?

本文发布于:2023-08-07 10:26:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1318612.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   地址

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!