看起来远程主机可能有一个单独的服务器用于发送邮件,或者您必须将主机列入白名单才能发送邮件,并且可能需要用户名和密码。还没有查看您的代码,但是当涉及防火墙并且尝试发送的机器无法通过防火墙访问时,我看到了它们的错误,因为防火墙根本没有响应,您会得到类似“服务器没有”的答案没有及时响应”或“服务器在一定时间后没有响应”我假设在您在这里发帖之前,您已经向托管服务提供商询问了发送邮件的问题,以及对如何发送邮件有什么偏好被执行?对?
如果是这样,请提供他们所说的信息
这是发送电子邮件的代码示例:
var smtpClient = new SmtpClient();
var message = new MailMessage();
smtpClient.port = 25;
message.from = "test@test.com";
message.To.Add("me@workemail.com,client@office.com";
message.Subject = "Contact from website";
message.IsBodyHtml = true;
message.Body = "<html><head></head><body>TEST</body></html>"
try {
smtpClient.Host = "relay.server.you.have.from.host";
smtpClient.Send(message);
} catch( Exception ) {
// host is down or we are local try other servers
// here you can have more try / catch
smtpClient.Host = "127.0.0.1"
smtpClient.Send(message);
}