Changeset 5313

Show
Ignore:
Timestamp:
08/24/10 18:01:33 (18 months ago)
Author:
mtld
Message:

made emailsender charset configurable

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-0.13.x/pfixcore/src/de/schlund/pfixcore/util/email/EmailSender.java

    r3367 r5313  
    7272            throws EmailSenderException { 
    7373        sendMail(subject, text, null, to, from, smtphost, null, null, false); 
     74    } 
     75     
     76    public static void sendMail( 
     77            String subject, 
     78            String text, 
     79            String[] to, 
     80            String from, 
     81            String smtphost, 
     82            String encoding) 
     83            throws EmailSenderException { 
     84        sendMail(subject, text, null, to, from, smtphost, null, null, false, encoding); 
    7485    } 
    7586     
     
    101112    } 
    102113     
     114    public static void sendMail( 
     115            String subject, 
     116            String text, 
     117            String[] to, 
     118            String from, 
     119            String smtphost, 
     120            String authuser, 
     121            String authpassword, 
     122            String encoding) 
     123            throws EmailSenderException { 
     124        sendMail(subject, text, null, to, from, smtphost, authuser, authpassword, false, encoding); 
     125    } 
     126     
    103127    /** 
    104128     * Send an email. 
     
    123147            throws EmailSenderException { 
    124148        sendMail(subject, text, headers, to, from, smtphost, null, null, false); 
     149    } 
     150     
     151    public static void sendMail( 
     152            String subject, 
     153            String text, 
     154            Map<String, String> headers, 
     155            String[] to, 
     156            String from, 
     157            String smtphost, 
     158            String encoding) 
     159            throws EmailSenderException { 
     160        sendMail(subject, text, headers, to, from, smtphost, null, null, false, encoding); 
    125161    } 
    126162     
     
    145181     */ 
    146182    public static void sendMail( 
     183            String subject, 
     184            String text, 
     185            Map<String, String> headers, 
     186            String[] to, 
     187            String from, 
     188            String smtphost, 
     189            String authuser, 
     190            String authpassword, 
     191            boolean secure) 
     192            throws EmailSenderException { 
     193        sendMail(subject, text, headers, to, from, smtphost, authuser, authpassword, secure, CHARSET); 
     194    } 
     195     
     196    public static void sendMail( 
    147197        String subject, 
    148198        String text, 
     
    153203        String authuser, 
    154204        String authpassword, 
    155         boolean secure) 
     205        boolean secure, 
     206        String encoding) 
    156207        throws EmailSenderException { 
    157208 
     
    231282        // got everything, now send mail 
    232283        try { 
    233             msg.setText(text, CHARSET); 
    234             msg.setHeader("Content-Type", "text/plain; charset=" + CHARSET); 
     284            msg.setText(text, encoding); 
     285            msg.setHeader("Content-Type", "text/plain; charset=" + encoding); 
    235286            msg.setHeader("Content-Transfer-Encoding", "8bit"); 
    236287             
     
    247298             
    248299            msg.setRecipients(Message.RecipientType.TO, toaddresses); 
    249             msg.setSubject(subject, CHARSET); 
     300            msg.setSubject(subject, encoding); 
    250301            msg.setFrom(fromaddress); 
    251302            msg.setSentDate(new Date()); 
     
    306357        } 
    307358    } 
    308  
     359     
    309360}