Alguém ja mandou um email usando a api mail4me?
public void startApp() {
Message message = new Message("xxx@gmail.com", "xxx@gmail.com", "555555");
message.addBodyLine( "mandei um email");
SmtpClient smtpClient = new SmtpClient(null);
try {
smtpClient.open("xxx.gmail.com", 0, false, "xxx@gmail.com", "123456");
} catch (IOException ex) {
ex.printStackTrace();
} catch (MailException ex) {
ex.printStackTrace();
}
try {
smtpClient.sendMessage(message);
} catch (IOException ex) {
ex.printStackTrace();
} catch (MailException ex) {
ex.printStackTrace();
}
smtpClient.close();
}
tentei e o resultado…
de.trantor.mail.MailException: 530 5.7.0 Must issue a STARTTLS command first. 20sm581914yxe.20
at de.trantor.mail.SmtpClient.execute(+103)
at de.trantor.mail.SmtpClient.open(+102)
at Midlet.startApp(Midlet.java:28)
at javax.microedition.midlet.MIDletProxy.startApp(MIDletProxy.java:43)
at com.sun.midp.midlet.Scheduler.schedule(Scheduler.java:374)
at com.sun.midp.main.Main.runLocalClass(Main.java:466)
at com.sun.midp.main.Main.main(Main.java:120)
startApp threw an Exception
java.lang.NullPointerException
java.lang.NullPointerException
at de.trantor.mail.j2me.ConnectionImpl.write(+7)
at de.trantor.mail.Connection.send(+133)
at de.trantor.mail.SmtpClient.execute(+12)
at de.trantor.mail.SmtpClient.sendMessage(+34)
at de.trantor.mail.SmtpClient.sendMessage(+13)
at Midlet.startApp(Midlet.java:35)
at javax.microedition.midlet.MIDletProxy.startApp(MIDletProxy.java:43)
at com.sun.midp.midlet.Scheduler.schedule(Scheduler.java:374)
at com.sun.midp.main.Main.runLocalClass(Main.java:466)
at com.sun.midp.main.Main.main(Main.java:120)