重新提出问题
此代码不起作用
错误是: The remote certificate is invalid according to the validation procedure.
var client = new SmtpClient("smtp.domain.com.br", 25000)
{
Credentials = new NetworkCredential("username", "password"),
EnableSsl = true
};
client.Send("emailfrom@domain.com.br", "emailto@gmail.com", "test", "testbody");
// I also tested like this
// client.Send("emailfrom@domain.com.br", "emailto@domain.com", "test", "testbody");
但是这段代码有效
var client = new SmtpClient("smtp.gmail.com", 587)
{
Credentials = new NetworkCredential("username", "password"),
EnableSsl = true
};
client.Send("emailfrom@domain.com.br", "emailto@gmail.com", "test", "testbody");
我在 Outlook 中测试了第一个代码数据,如果我尝试从同一域发送电子邮件,则可以正常工作。
我相信错误是一些 SMTP 配置,但我不知道如何解决这个问题。有什么帮助吗?