問題を解決しました。 私は何が起こっているのか正確にはわかりませんが、SpringBoot JavaMailSenderImplを使用してAWS SESを使用して電子メールを送信すると、すべての電子メールがDKIM(送信メールメッセージのDKIMヘッダーなし)を使用して署名されませんでした。これは、一部のSMTPサーバーが私たちの電子メールをスパムとして扱う原因となっていました。
メールを送信するためにJava Mail API(javax.mail)を使用して問題を解決しました。これを済ませたら、すべてのメールメッセージはDKIMヘッダーで配信され、そのうちの誰もSPAMフォルダには行きませんでしたGmailとOutlook)。
また、なぜSpringBoot JavaMailSenderImplを使用して問題が発生しているのかわかりません。私の理解では、JavaMailSenderImplはシーンの背後でJava Mailを使用していますが、何らかの理由でDKIMヘッダが含まれていない電子メールはありません。
以下は、私のメール送信者が誰かを助けてくれるならば、Java Mailを使っています。
try {
Properties properties = new Properties();
// get property to indicate if SMTP server needs authentication
boolean authRequired = true;
properties.put("mail.smtp.auth", authRequired);
properties.put("mail.smtp.host", "ses smtp hostname");
properties.put("mail.smtp.port", 25);
properties.put("mail.smtp.connectiontimeout", 10000);
properties.put("mail.smtp.timeout", 10000);
properties.put("mail.smtp.starttls.enable", false);
properties.put("mail.smtp.starttls.required", false);
Session session;
if (authRequired) {
session = Session.getInstance(properties, new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("ses_username","ses_password");
}
});
} else {
session = Session.getDefaultInstance(properties);
}
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress("[email protected]"));
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("[email protected]"));
message.setSubject("This is a test subject");
Multipart multipart = new MimeMultipart();
BodyPart htmlPart = new MimeBodyPart();
htmlPart.setContent("This is test content", "text/html");
htmlPart.setDisposition(BodyPart.INLINE);
multipart.addBodyPart(htmlPart);
message.setContent(multipart);
Transport.send(message);
} catch (Exception e) {
//deal with errors
}
http://www.isnotspam.com/のようなオンラインスパムテスターを試してみてください。 – Veve