commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mathias Berg" <mathiasber...@gmail.com>
Subject [EMAIL] - Sending both text plain and html.
Date Tue, 19 Dec 2006 08:51:36 GMT
Hi, if im not misstaken common-email can  send both a body part with a
plain text and a body part of html in one mail. So the reciever either
get the text or html depending on the recievers email client settings.

Is this true?

Then second question how to i impl that. Like this?

Tx for any help.
....................

org.apache.commons.mail.Email email;
        if (emailConfig.isHtml()) {
            email = new HtmlEmail();
        } else {
            email = new SimpleEmail();
        }

......

if (emailConfig.isHtml() && email instanceof HtmlEmail) {
    ((HtmlEmail)email).setHtmlMsg(emailConfig.getHtmlMessage());
}
email.setMsg("Text plain text");

...

email.buildMimeMessage();
email.send();

........................................

Best regards, Mathias.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message