email address on GAE

Tag: google-app-engine , email Author: arthurlau Date: 2012-07-25

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].

Other Answer1

Yes you can: https://developers.google.com/appengine/docs/java/mail/usingjavamail#Senders_and_Recipients

comments:

But its not telling me that from where to create an email address ?
You don't need to create it, you just use them as if they already exist.
check my edited question
Why don't you just change the fromAdress variable?
even if I change that fromAddress variable, but that address don't exist in real.

Other Answer2

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).

comments:

but how to create one ?
Create what exactly?
want to create an email address like [email protected]. cant i create one ? if yes then from where ?
No, you can not do that.
@PeterKnego setFrom() and [email protected] no?