If your code sends out an email, you need to be aware of a few issues.
In order for for us to prevent unauthorized use of our smtp servers, we limit access to our clients. Therefore, before sending out any email, you must authenticate yourself against our system.
Java Code looks as follows:
import java.util.*,
import javax.mail.*,
import javax.mail.internet.*,
Properties props = new Properties();
props.put("mail.smtp.host", "smtp.your_mail_server.com");
Session s = Session.getInstance(props,null);
MimeMessage message = new MimeMessage(s);
// ***** IMPORTANT *******
// THIS MUST BE A VALID EMAIL ON YOUR DOMAIN!!!!
String sFrom = "email@yourdomain.com";
// **************************
String sTo = "some@somedomain.com";
String sSubject = "test mail";
String sBody = "this is the test";
try {
InternetAddress from = new InternetAddress(sFrom);
message.setFrom(from);
InternetAddress to = new InternetAddress(sTo);
message.addRecipient(Message.RecipientType.TO, to);
message.setSubject(sSubject);
message.setText(sBody);
Store store = s.getStore("pop3");
store.connect( "pop.you_mail_server.com", your_username, your_password );
Transport.send(message);
out.println("message sent");
} catch (Exception e) {
out.println(e.getMessage());
}