gpt4 book ai didi

java - Google 应用引擎邮件发送没有错误,但在收件箱中找不到

转载 作者:行者123 更新时间:2023-12-02 07:06:52 25 4
gpt4 key购买 nike

我正在使用 Google 应用引擎的邮件发送电子邮件。下面是我的代码

Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);

Message msg = new MimeMessage(session);
try {
msg.setFrom(new InternetAddress(from));
msg.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
msg.setSubject(subject);
msg.setText(message);
Transport.send(msg);
} catch (AddressException e) {
throw new InvalidMailInputException("Invalid email.");
} catch (MessagingException e) {
throw new InvalidMailInputException("Unable to send eamil at this time.");
}

日志:

Apr 13, 2013 5:26:29 PM com.google.appengine.api.mail.dev.LocalMailService log
INFO: MailService.send
Apr 13, 2013 5:26:29 PM com.google.appengine.api.mail.dev.LocalMailService log
INFO: From: myaddress@gmail.com
Apr 13, 2013 5:26:29 PM com.google.appengine.api.mail.dev.LocalMailService log
INFO: To: myaddress@gmail.com
Apr 13, 2013 5:26:29 PM com.google.appengine.api.mail.dev.LocalMailService log
INFO: Reply-to: myaddress@gmail.com
Apr 13, 2013 5:26:29 PM com.google.appengine.api.mail.dev.LocalMailService log
INFO: Subject: Appoint has been cancelled successfully (5)
Apr 13, 2013 5:26:29 PM com.google.appengine.api.mail.dev.LocalMailService log
INFO: Body:
Apr 13, 2013 5:26:29 PM com.google.appengine.api.mail.dev.LocalMailService log
INFO: Content-type: text/plain
Apr 13, 2013 5:26:29 PM com.google.appengine.api.mail.dev.LocalMailService log
INFO: Data length: 147

在日志消息中我没有收到任何错误。但是,我也没有收到电子邮件。

感谢您的帮助。

最佳答案

您似乎正在使用本地开发服务器。在这种情况下,实际上不会发送任何邮件。

来自: https://developers.google.com/appengine/docs/java/mail/overview#Development_Server

When an application running in the development server calls the Mail service to send an email message, the message is printed to the log. The Java development server does not send the email message.

关于java - Google 应用引擎邮件发送没有错误,但在收件箱中找不到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15993297/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com