邮件不是由app-engine发送的,它卡在任务队列中没有生成错误

时间:2013-09-27 15:07:09

标签: java google-app-engine javamail

我使用过github项目jappstart https://github.com/taylorleese/google-app-engine-jappstart 例如,在将应用程序部署到prod中的app-engine之后,无法使应用程序发送授权电子邮件。

同样在app-engine日志中没有生成未经授权的发件人错误,所以看起来我正在使用正确的发件人电子邮件。我意识到在任务队列中生成了邮件队列但是现在按下按钮按钮没有帮助:/任何想法?

prod属性文件

google.app.id= -Application Identifier-
google.app.version=1

google.jsapi.http.key=enterKey
google.jsapi.https.key=enterKey

application.secureChannel=https
application.hostname= -Application Identifier Alias-

jquery.ver=1.7.1

mail.fromAddress= -owner/admin email-

ActivationEmail方法

public final void sendActivationEmail(final UserAccount user,
    final String locale)
    throws MessagingException {
    final Properties props = new Properties();
    final Session session = Session.getDefaultInstance(props, null);
    final Message message = new MimeMessage(session);
    final Multipart multipart = new MimeMultipart();
    final MimeBodyPart htmlPart = new MimeBodyPart();
    final MimeBodyPart textPart = new MimeBodyPart();

    message.setFrom(new InternetAddress(getFromAddress()));
    message.addRecipient(Message.RecipientType.TO,
        new InternetAddress(user.getEmail()));

    message.setSubject(messageSource.getMessage("mail.subject", null,
        new Locale(locale)));

    textPart.setContent(messageSource.getMessage("mail.body.txt",
        new Object[] {getHostname(), user.getActivationKey()},
        new Locale(locale)), "text/plain");

    htmlPart.setContent(messageSource.getMessage("mail.body.html",
        new Object[] {getHostname(), user.getActivationKey()},
        new Locale(locale)), "text/html");

    multipart.addBodyPart(textPart);
    multipart.addBodyPart(htmlPart);
    message.setContent(multipart);

    Transport.send(message);
}

0 个答案:

没有答案