Search in sources :

Example 1 with MailHandler

use of org.apache.openmeetings.core.mail.MailHandler in project openmeetings by apache.

the class TestMailSending method getMimeMessage.

private MimeMessage getMimeMessage() throws Exception {
    MailHandler h = new MailHandler();
    h.init(smtpServer, smtpPort, from, mailAuthUser, mailAuthPass, mailTls, true);
    // Building MimeMessage
    MimeMessage msg = h.getBasicMimeMessage();
    msg.setSubject("getSubject()");
    msg.addRecipients(Message.RecipientType.TO, InternetAddress.parse("test-recipient@gmail.com", false));
    return h.appendBody(msg, "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.");
}
Also used : MailHandler(org.apache.openmeetings.core.mail.MailHandler) MimeMessage(javax.mail.internet.MimeMessage)

Aggregations

MimeMessage (javax.mail.internet.MimeMessage)1 MailHandler (org.apache.openmeetings.core.mail.MailHandler)1