我正在尝试从部署在 Godaddy Windows 2012 Vitual Private Server 中的 Web 应用程序发送电子邮件。
错误显示“服务器主动拒绝连接”。
电子邮件从我的本地系统发送,但传出的电子邮件在 Godaddy 主机上不起作用。
using (var smtp = new SmtpClient()) { 
    var credential = new NetworkCredential { 
        UserName = "user@outlook.com", 
        Password = "password" }; 
    smtp.Credentials = credential; 
    smtp.Host = "smtp.gmail.com"; 
    smtp.Port = 587; 
    smtp.EnableSsl = true; 
    await smtp.SendMailAsync(message); 
    return RedirectToAction("Sent"); 
}