I have written an app that sends email notifications to it's users
under some circumstances. Sometimes it works, other times it doesn't.
The code doesn't change and I am using the same small set of emails
addresses to send and receive emails so I can't see what I am doing
wrong.

When it fails I get exceptions that begin like this;

MessagingException: MailService IO failed (java.io.IOException:
Internal error)
javax.mail.SendFailedException: MailService IO failed
(java.io.IOException: Internal error)
        at
com.google.appengine.api.mail.stdimpl.GMTransport.sendMessage(GMTransport.java:
253)
        at javax.mail.Transport.send(Transport.java:95)
        at javax.mail.Transport.send(Transport.java:48)
        at com.hotf.server.EmailService$1.run(EmailService.java:119)

So I thought I would set up a deferred task queue and configure it to
keep trying every 15 minutes until it works.

Now emails fail with the same error for anything up to eight or nine
hours, then without reason or explanation the email service will
suddently start working and all the emails will be delivered.

I have searched through this group and found and number of people have
had problems but I don't think any of them apply to the testing I am
doing. I am sending from the email address of the apps administrator
account, I have no quotes in my email addresses etc...

The only lead I haven't followed up yet is that someone suggested the
email service is unreliable if you don't enable billing. So before I
take that step, can someone point out anything else I may be doing
wrong please.

My code is;

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

try {

Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress("hotf...@gmail.com", "Heroes of The
Fall"));
String email = a.getEmail().replace("\"","").replace("'", "").trim();
msg.addRecipient(Message.RecipientType.TO,new InternetAddress(email,
a.getName()));
msg.setSubject(subject);
msg.setText(body);
log.info("Sending notification email to " + email);
Transport.send(msg);

} catch (UnsupportedEncodingException e) {
log.log(Level.SEVERE, "MessagingException: " + e.getMessage(), e);
e.printStackTrace();
throw new RuntimeException(e);

} catch (AddressException e) {
log.log(Level.SEVERE, "MessagingException: " + e.getMessage(), e);
e.printStackTrace();
throw new RuntimeException(e);

} catch (MessagingException e) {
log.log(Level.SEVERE, "MessagingException: " + e.getMessage(), e);
e.printStackTrace();
throw new RuntimeException(e);

} catch (Exception e) {
log.severe(e.getMessage());
e.printStackTrace();
throw new RuntimeException(e);
}

}

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to