SmtpClient和GoDaddy的远程服务器 [英] SmtpClient and GoDaddy remote server
问题描述
在一个网站,我工作,我只是需要它来发送电子邮件到几个地址,我的code正常工作在我的本地和使用远程邮件服务器发送的电子邮件。然而,当我发布网站的服务器我得到这个异常:
On a website I was working on I simply need it to send a email to a few addresses, my code works fine on my localhost and send the emails using the remote mail server. However when I publish the website to the server I get this exception:
命令的次序错误服务器响应为:试图发送到非本地电子邮件地址时,该邮件服务器需要身份验证,请检查您的邮件客户端设置,或与管理员联系以验证该域名或地址定义此服务器。
"Bad sequence of commands. The server response was: This mail server requires authentication when attempting to send to a non-local e-mail address. Please check your mail client settings or contact your administrator to verify that the domain or address is defined for this server."
下面是我的code:
SmtpClient client = new SmtpClient("mail.domain.com", 25);
client.Credentials = new NetworkCredential("default@domain.com", "password
client.UseDefaultCredentials = false;
MailMessage message = new MailMessage();
foreach (string address in db.Administrators.Select(e => e.Email))
message.To.Add(address);
message.From = new MailAddress(email.FromEmailAddress);
message.Subject = email.Subject;
message.Body = email.Message;
client.Send(message);
有其他人有这个问题?它是GoDaddy的具体点吗?
Has anybody else had this issue? Is it GoDaddy specific?
谢谢, 亚历克斯。
推荐答案
只需使用此
MailMessage m = new MailMessage("default@domain.com", "to", "subject", "body");
m.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient("relay-hosting.secureserver.net");
smtp.UseDefaultCredentials = true;
smtp.Send(m);
我就同样的问题,面对几个月前它的工作对我来说...
i had same problem faced couple of months ago it worked for me...
这篇关于SmtpClient和GoDaddy的远程服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!