使用Mailjet(Azure)和C#

时间:2019-10-16 18:20:56

标签: c# azure smtp mailjet

我将Azure用于ASP.NET/C#项目。我试图通过Azure使用Mailjet。因此,我进行了设置。但是,我一直收到此错误...(电子邮件地址被屏蔽)

Client does not have permission to submit mail to this server. 
The server response was: 4.7.1 <xxxx@xxxx.com>: Relay access denied

这是代码。...

SmtpClient SmtpServer = new SmtpClient("in-v3.mailjet.com", 587);
SmtpServer.Credentials = new NetworkCredential(API_KEY, SECRET_KEY);
SmtpServer.DeliveryMethod = SmtpDeliveryMethod.Network;
SmtpServer.EnableSsl = true;
SmtpServer.UseDefaultCredentials = false;
mail.From = new MailAddress("xxxx@xxxx.com");
mail.To.Add(toAddress);
mail.Subject = subject;
mail.Body = messageBody;
mail.IsBodyHtml = true;
string filename = (attachmentFilename == null) ? "attachment.pdf" : attachmentFilename;
mail.Attachments.Add(new Attachment(attachment, filename));
SmtpServer.Send(mail);

在Azure的Mailjet电子邮件服务中,我确实手动验证了“ xxxx@xxxx.com”电子邮件地址。我相信我所有的代码和凭证都是正确的。我验证了密钥/秘密以及服务器和端口。任何建议,将不胜感激。

0 个答案:

没有答案