Nazdar, mam jeden problem pri zasielani mailov v jave za pomoci JAVA MAIL API
Takze pre zasielanie pouzivam nasledovny zdrojak:
Kód:
Properties props = new Properties();
props.put("mail.transport.protocol", "smtps");
props.put("mail.smtps.host", SMTP_HOST_NAME);
props.put("mail.smtps.auth", "true");
Session mailSession = Session.getDefaultInstance(props);
mailSession.setDebug(true);
Transport transport = mailSession.getTransport();
MimeMessage message = new MimeMessage(mailSession);
message.setSubject(subject);
message.setContent(text, "text/plain");
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO,
new InternetAddress(dst));
transport.connect
(SMTP_HOST_NAME, SMTP_HOST_PORT, SMTP_AUTH_USER, SMTP_AUTH_PWD);
transport.sendMessage(message,
message.getRecipients(Message.RecipientType.TO));
transport.close();
Vysledok zasielania sprav :
Ahoj ako sa m\u00E1\u0161 ?
Normalne to ma byt: Ahoj ako sa mas ?
Debug zasielania:
Kód:
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Ahoj ako sa m\u00E1\u0161 ?
.
250 2.0.0 OK 1300458174 f16sm1403922faa.38
QUIT
221 2.0.0 closing connection f16sm1403922faa.38
Za skoru odpoved vopred vdaka