Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Email AWS SES电子邮件即使在验证后也会变成垃圾邮件_Email_Amazon Web Services_Spam_Amazon Ses - Fatal编程技术网

Email AWS SES电子邮件即使在验证后也会变成垃圾邮件

Email AWS SES电子邮件即使在验证后也会变成垃圾邮件,email,amazon-web-services,spam,amazon-ses,Email,Amazon Web Services,Spam,Amazon Ses,我相信很多人问了同样的问题,但我找不到一个全面的答案。 我们正在悉尼地区部署的EC2实例上运行一个web应用程序(myapp.com)。该应用程序通过AWS SES发送电子邮件。由于SES在悉尼不可用,我们在俄勒冈州配置了SES。我们生成了SMTP凭据,并将Springboot应用程序配置为使用这些凭据发送电子邮件。我们能够发送电子邮件,电子邮件成功送达,但它会进入垃圾邮件文件夹。 电子邮件发件人地址为:noreply@myapp.com 我们已经在SES控制台中验证了域名 我们已经核实了结果n

我相信很多人问了同样的问题,但我找不到一个全面的答案。 我们正在悉尼地区部署的EC2实例上运行一个web应用程序(myapp.com)。该应用程序通过AWS SES发送电子邮件。由于SES在悉尼不可用,我们在俄勒冈州配置了SES。我们生成了SMTP凭据,并将Springboot应用程序配置为使用这些凭据发送电子邮件。我们能够发送电子邮件,电子邮件成功送达,但它会进入垃圾邮件文件夹。 电子邮件发件人地址为:noreply@myapp.com 我们已经在SES控制台中验证了域名 我们已经核实了结果noreply@myapp.comSES控制台中的电子邮件地址 DKIM也被打开并验证

但是,, 我们不知道为什么电子邮件会一直被发送到垃圾邮件文件夹。 当我查看原始电子邮件时,我可以看到SPF标题: SPF:中性点,IP为xx.xx.xx.xxx 我没有在我的DNS名称中配置任何SPF记录,但据我所知,我不需要配置,因为我使用的是SES SMTP服务器,而不是来自的自定义邮件

我不知道为什么电子邮件会被发送到垃圾邮件。 有人能帮忙吗?

解决了这个问题。 我不确定到底发生了什么,但当使用SpringBoot JavaMailSenderImpl使用AWS SES发送电子邮件时,所有电子邮件都没有使用DKIM签名(传出电子邮件上没有DKIM头)。这导致一些SMTP服务器将我们的电子邮件视为垃圾邮件

我已经通过使用JavaMail API(javax.Mail)发送电子邮件解决了这个问题,一旦我这样做了,所有的电子邮件都会使用DKIM头发送,其中没有一封会发送到垃圾邮件文件夹(根据Gmail和Outlook进行测试)

同样,我不确定为什么使用SpringBoot JavaMailSenderImpl会导致这个问题。我的理解是JavaMailSenderImpl在幕后使用Java邮件,但出于某种原因,没有一封邮件包含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("from@example.com"));
            message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("to@example.com"));

            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

        }

尝试一些在线垃圾邮件测试,比如说,多部分测试帮助我解决了垃圾邮件问题