this is my code at server side for sending email (my server is google app engine)..
public static void Email(String test) {
DateFormat formatter ;
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
try{
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress("Sender email", "Automatic email"));
msg.addRecipient(
Message.RecipientType.TO,
new InternetAddress("Recepient email"));
msg.setSubject(test);
msg.setText(test);
Transport.send(msg);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MessagingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}