I\'m using javamail to send mails from my appengine application. It works perfectly in the deployment, but I can\'t figure out how to do this using the development server. Whene
GAE uses JavaMail, so it's not too difficult to get it working. There are two things you'll need to change.
The first is to set up your JavaMail session properly for your STMP server. To do this, instead of using Session.getDefaultInstance
, use Session.getInstance
, providing at least the mail.smtp.host
properties. See JavaMail SMTP reference, or just look for a generic JavaMail SMTP tutortial.
The second change is that you need to stop GAE handling your emails. It does this because of the line
rfc822=gm
in META-INF/javamail.address.map in the SDK jar. You can either include your own address map - but that is annoying because I assume you only want it for debugging - or modify the address map from code. That is as simple as doing
session.setProtocolForAddress("rfc822", "smtp");
on the session you created in the first step. That should route all your emails to the standard SMTP handler.