首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >STOREDRV.Submission.Exception:OutboundSpamException例外: JavaMail

STOREDRV.Submission.Exception:OutboundSpamException例外: JavaMail
EN

Stack Overflow用户
提问于 2016-09-09 09:13:34
回答 1查看 6.2K关注 0票数 3

我使用java邮件API从Gmail、Hotmail和Outlook帐户发送电子邮件。它在Gmail和Hotmail、上运行得很好,但在Outlook上却不起作用。

Outlook发件人类代码

代码语言:javascript
复制
public class OutlookSender extends javax.mail.Authenticator {


    private String mailhost = "smtp-mail.outlook.com";
    private String user;
    private String password;
    private Session session;

    static {
        Security.addProvider(new JSSEProvider());
    }

    public OutlookSender(String user, String password) {
        this.user = user;
        this.password = password;


        Properties props = new Properties();
        props.setProperty("mail.transport.protocol", "smtp");
        props.setProperty("mail.host", mailhost);
        props.put("mail.smtp.auth", "true");
        props.put("mail.smtp.starttls.enable", "true");
        props.put("mail.smtp.port", "587");


        session = Session.getDefaultInstance(props, this);
        session.setDebug(true);
    }

    protected PasswordAuthentication getPasswordAuthentication() {
        return new PasswordAuthentication(user, password);
    }

    public synchronized void sendMail(String subject, String body,
                                      String sender, String recipients) throws Exception {
        MimeMessage message = new MimeMessage(session);
        DataHandler handler = new DataHandler(new ByteArrayDataSource(body.getBytes(), "text/plain"));
        message.setSender(new InternetAddress(sender));
        message.setSubject(subject);
        message.setDataHandler(handler);

        if (recipients.indexOf(',') > 0){
            message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(recipients));

        } else{
            message.setRecipient(Message.RecipientType.TO, new InternetAddress(recipients));

        }
        message.saveChanges();

        //Transport trans = session.getTransport("smtp");
        Transport transport = session.getTransport("smtp");
        transport.connect(mailhost, user, password);
        transport.sendMessage(message, message.getAllRecipients());
        transport.close();
    }
}

发送电子邮件的代码:

代码语言:javascript
复制
OutlookSender sender = new OutlookSender("abc@outlook.com", "password");
sender.sendMail("Hello Text", "Body Text Sample", "abc@outlook.com", "zxy@gmail.com");

发送后,我从logcat获得了一个内容为:的异常

代码语言:javascript
复制
javax.mail.MessagingException: 554-554 5.2.0 STOREDRV.Submission.Exception:OutboundSpamException; Failed to process message due to a permanent exception with message WASCL UserAction verdict is not None. Actual verdict is HipSend...

请帮助解释异常的原因和如何解决这个问题。谢谢。

EN

回答 1

Stack Overflow用户

发布于 2016-11-29 08:15:48

这是outlook安全,它需要使用web登录。您也可以检查此邮件以解锁您的帐户。

你好xxxxx,若要继续发送消息,请登录并验证您的Outlook.com帐户。这有助于我们阻止自动程序发送垃圾邮件。感谢您的帮助和耐心!Outlook.com团队

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39407964

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档