0

我有一个申请,google app engineabc.appspot.com可以有一个电子邮件地址来发送/接收电子邮件,比如admin@abc.appspot.com请帮助我。

编辑 这里是我的SendMail

public class SendMail {
  private static String fromAddress = "abc@gmail.com";

  private static Logger log = Logger.getLogger(SendMail.class.getCanonicalName());

  // Send the Mail
  public void send(String toAddress, String subject, String msgBody)
      throws IOException {

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

    try {
      Message msg = new MimeMessage(session);
      msg.setFrom(new InternetAddress(fromAddress));
      InternetAddress to = new InternetAddress(toAddress);
      msg.addRecipient(Message.RecipientType.TO, to);
      msg.setSubject(subject);
      msg.setText(msgBody);
      Transport.send(msg, new InternetAddress[] { to });

    } catch (AddressException addressException) {
      log.log(Level.SEVERE, "Address Exception , mail could not be sent", addressException);
    } catch (MessagingException messageException) {
      log.log(Level.SEVERE, "Messaging Exception , mail could not be sent", messageException);
    }
  }
}

所以它会发送一封电子邮件,abc@gmail.com但我希望它应该从email@abc.appspot.com.

4

2 回答 2

1

您只能接收格式为 的电子邮件@abc.appspotmail.com。AFAIK 没有办法@abc.appspot.com作为接收地址。

如果您想从您的自定义域接收电子邮件,例如@abc.com,唯一的方法是让外部电子邮件服务将电子邮件转发到您的@abc.appspotmail.com. 大多数域名注册商提供免费的有限转发电子邮件服务(我们使用 GoDaddy 并免费获得有限转发)。

于 2012-08-10T16:44:51.817 回答
0

是的,您可以:https ://developers.google.com/appengine/docs/java/mail/usingjavamail#Senders_and_Recipients

于 2012-08-10T14:30:33.273 回答