Wie ändern Zeichensatz im Apache Commons E-Mail?

Ich bin mit Apache Commons E-Mail senden E-Mail an meine Kunden, aber ich habe einen client namens "Semana da Computação' (in portugues BR), aber es geht Semana da Computação' .
Ich versuche das zu ändern mein code, aber nichts funktioniert:

public static boolean emailWithImage(String subject, String message, String emailReceiver, String imageURL) {
    HtmlEmail email = new HtmlEmail();
    email.setCharset("UTF-8"); //I change here, but it is not working
    email.setHostName(Constantes.EMAIL_HOST_NAME);
    email.setSmtpPort(587);
    DefaultAuthenticator authenticator =
            new DefaultAuthenticator(Constantes.EMAIL_USER, Constantes.EMAIL_PASSWORD);
    email.setAuthenticator(authenticator);
    email.setTLS(true);

    try {
        email.setFrom(Constantes.EMAIL_USER, Constantes.EMAIL_NAME);
        email.setSubject(subject);
        email.addTo(emailReceiver);

        URL url = new URL(imageURL);
        String cid = email.embed(url, "image");        /* it must be 'cid' the name of the image */

        email.setHtmlMsg("<html><img src=\"cid:" + cid + "\"> <p>" + message + "</p> </html>"); /* set the html message */
        email.setTextMsg(message);                     /* send a alternative text in case when the email reader don't support html */

        email.send();
    } catch (EmailException ex) {
        return false;
    } catch (MalformedURLException ex) {
        return false;
    }

    return true;
}

Irgendwelche Ideen? Warum ist der name nicht kommen durch korrekt und wie kann ich es beheben?

InformationsquelleAutor Valter Silva | 2011-04-25
Schreibe einen Kommentar