Muaz Usmani
Muaz Usmani

Reputation: 1318

email address on GAE

I have an application on google app engine like abc.appspot.com can I have an email address to send/receive emails like [email protected] kindly help me.

Edit here is my SendMail class

public class SendMail {
  private static String fromAddress = "[email protected]";

  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);
    }
  }
}

So it sends an email regarding [email protected] but I want that it should send from [email protected].

Upvotes: 0

Views: 446

Answers (2)

Peter Knego
Peter Knego

Reputation: 80340

You can only receive emails in the form of @abc.appspotmail.com. AFAIK there is no way to have @abc.appspot.com as receiving address.

If you wan to receive emails from your custom domain, e.g. @abc.com, than the only way is to have external email service forward emails to your @abc.appspotmail.com. Most domain registrars offer free limited email service with forwarding (we use GoDaddy and get limited forwarding free).

Upvotes: 1

Related Questions