邮件不会进入美国服务器?

时间:2015-10-14 07:16:51

标签: java javamail

我在美国服务器部署了我的客户端和服务器war文件。在发送邮件的时候我收到了一个错误,

这是我的LogMessage错误:

 23:05:29,955 ERROR [stderr] (Thread-71)  javax.mail.AuthenticationFailedException: 534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbtqm
 23:05:29,982 ERROR [stderr] (Thread-71) 534-5.7.14 jQ5DP9vIEim-h6P_m8i8Mi5EL55j74Hl1gP-RHP8IRi2xpG5uHG9om7uShHlDFOEIZGI6i
 23:05:30,000 ERROR [stderr] (Thread-71) 534-5.7.14 3DcMM9uohcpo65evt_KbVhylTUsIInbaG5x8J0BgOF69th8BEy7FsbSWdQfnrmwHqoukcw
 23:05:30,016 ERROR [stderr] (Thread-71) 534-5.7.14 5_bfCGixiuHZvIVTc6Ar3Sk3gkylpDUgiPCHIX45qfR7NrI2wmiRyYMolIzhvPDBR_6gde
 23:05:30,027 ERROR [stderr] (Thread-71) 534-5.7.14 XJYBJhcAryeMPgJR9sOZJ0gqp1k4> Please log in via your web browser and
 23:05:30,031 ERROR [stderr] (Thread-71) 534-5.7.14 then try again.
 23:05:30,032 ERROR [stderr] (Thread-71) 534-5.7.14  Learn more at
 23:05:30,034 ERROR [stderr] (Thread-71) 534 5.7.14  https://support.google.com/mail/answer/78754 qr8sm3589606pbb.47 - gsmtp
 23:05:30,037 ERROR [stderr] (Thread-71) 
 23:05:30,038 ERROR [stderr] (Thread-71)    at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:809)
 23:05:30,041 ERROR [stderr] (Thread-71)    at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:752)
 23:05:30,044 ERROR [stderr] (Thread-71)    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:669)
 23:05:30,046 ERROR [stderr] (Thread-71)    at javax.mail.Service.connect(Service.java:295)
 23:05:30,048 ERROR [stderr] (Thread-71)    at javax.mail.Service.connect(Service.java:176)
 23:05:30,050 ERROR [stderr] (Thread-71)    at org.jboss.tools.thanqdoctor.util.JavaMail.sendMessageForSignup(JavaMail.java:200)
 23:05:30,053 ERROR [stderr] (Thread-71)    at org.jboss.tools.thanqdoctor.util.JavaMail.sendEmailForProfileActivation(JavaMail.java:328)
 23:05:30,056 ERROR [stderr] (Thread-71)    at org.jboss.tools.thanqdoctor.util.JavaMail.run(JavaMail.java:104)
 23:05:30,058 ERROR [stderr] (Thread-71)    at java.lang.Thread.run(Thread.java:701)

这是My Source Sent Mail收到的拒绝我的目的地邮件的消息:

交付给以下收件人永久失败:

 root@gmail.com

Technical details of permanent failure:
Google tried to deliver your message, but it was rejected by the server for the recipient domain gmail.com by gmail-smtp-in.l.google.com.    [2607:f8b0:400e:c01::1a].

The error that the other server returned was:
550-5.1.1 The email account that you tried to reach does not exist.         Please try
550-5.1.1 double-checking the recipient's email address for typos or
550-5.1.1 unnecessary spaces. Learn more at
550 5.1.1  https://support.google.com/mail/answer/6596    dg1si10237974pad.228 - gsmtp

这些是我在JavaMail中使用的方法:

 public static void setMailServerProperties() {
    Properties emailProperties = System.getProperties();
    emailProperties.put("mail.smtp.port", "587");
    emailProperties.put("mail.smtp.auth", "true");
    emailProperties.put("mail.smtp.starttls.enable", "true");
    mailSession = Session.getDefaultInstance(emailProperties, null);
}

public static MimeMessage sendEmailMessageForSignup(String to,String subject, String body) throws AddressException,
        MessagingException {
    String[] toEmails = { to };

    MimeMessage emailMessage = new MimeMessage(mailSession);
    /**
     * Set the mail recipients
     * */
    for (int i = 0; i < toEmails.length; i++) {
        emailMessage.addRecipient(Message.RecipientType.TO,
                new InternetAddress(toEmails[i]));
    }
    emailMessage.setSubject(subject);

    emailMessage.setContent(body, "text/html");  //for html email
    // emailMessage.setText(emailBody);// for a text email
    return emailMessage;
}

public static void sendMessageForSignup(String from, String password,String to, String sub, String body) throws AddressException, MessagingException {
    String emailHost = "smtp.gmail.com";
    Transport transport = mailSession.getTransport("smtp");
    transport.connect(emailHost, from, password);
    MimeMessage emailMessage = sendEmailMessageForSignup(to,sub,body);

    transport.sendMessage(emailMessage, emailMessage.getAllRecipients());
    transport.close();
    LogMsg.info("Email sent successfully.");
}

为美国和印度发送邮件的区别是什么。 任何身体都可以帮助我。

先谢谢,

MadanMohan

0 个答案:

没有答案