我只能在同一个邮箱域内发送邮件,但不能在其外发送邮件。我错过了什么吗?
try {
MailMessage mail = new MailMessage("noreply@company.com", "user@mail.com");
SmtpClient client = new SmtpClient();
client.Port = 25;
client.EnableSsl = true;
client.Timeout = 10000;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.UseDefaultCredentials = false;
client.Host = "smtp.company.com";
mail.Subject = "Thanks...";
mail.Body = "text...";
client.Send(mail);
} catch (Exception ex) {
Response.Write(ex.ToString());
}
发送到其他邮箱域时出现错误消息:
System.Net.Mail.SmtpFailedRecipientException:邮箱不可用。该 服务器响应是:5.7.1无法中继 System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection收件人,String deliveryNotify,布尔值 allowUnicode,SmtpFailedRecipientException&例外) System.Net.Mail.SmtpClient.Send(MailMessage消息)
我无法控制smtp主机,但我应该能够发送到其他邮件域。