Changeset 5317

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

made emailsender charset configurable

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-0.15.x/pustefix-core/src/main/java/de/schlund/pfixcore/util/email/EmailSender.java

    r4517 r5317  
    7373    } 
    7474     
     75    public static void sendMail( 
     76            String subject, 
     77            String text, 
     78            String[] to, 
     79            String from, 
     80            String smtphost, 
     81            String encoding) 
     82            throws EmailSenderException { 
     83        sendMail(subject, text, null, to, from, smtphost, null, null, false, encoding); 
     84    } 
     85     
    7586    /** 
    7687     * Send an email (without headers).  
     
    100111    } 
    101112     
     113    public static void sendMail( 
     114            String subject, 
     115            String text, 
     116            String[] to, 
     117            String from, 
     118            String smtphost, 
     119            String authuser, 
     120            String authpassword, 
     121            String encoding) 
     122            throws EmailSenderException { 
     123        sendMail(subject, text, null, to, from, smtphost, authuser, authpassword, false, encoding); 
     124    } 
     125     
    102126    /** 
    103127     * Send an email. 
     
    122146            throws EmailSenderException { 
    123147        sendMail(subject, text, headers, to, from, smtphost, null, null, false); 
     148    } 
     149     
     150    public static void sendMail( 
     151            String subject, 
     152            String text, 
     153            Map<String, String> headers, 
     154            String[] to, 
     155            String from, 
     156            String smtphost, 
     157            String encoding) 
     158            throws EmailSenderException { 
     159        sendMail(subject, text, headers, to, from, smtphost, null, null, false, encoding); 
    124160    } 
    125161     
     
    144180     */ 
    145181    public static void sendMail( 
     182            String subject, 
     183            String text, 
     184            Map<String, String> headers, 
     185            String[] to, 
     186            String from, 
     187            String smtphost, 
     188            String authuser, 
     189            String authpassword, 
     190            boolean secure) 
     191            throws EmailSenderException { 
     192        sendMail(subject, text, headers, to, from, smtphost, authuser, authpassword, secure, CHARSET); 
     193    } 
     194     
     195    public static void sendMail( 
    146196        String subject, 
    147197        String text, 
     
    152202        String authuser, 
    153203        String authpassword, 
    154         boolean secure) 
     204        boolean secure, 
     205        String encoding) 
    155206        throws EmailSenderException { 
    156207 
     
    230281        // got everything, now send mail 
    231282        try { 
    232             msg.setText(text, CHARSET); 
    233             msg.setHeader("Content-Type", "text/plain; charset=" + CHARSET); 
     283            msg.setText(text, encoding); 
     284            msg.setHeader("Content-Type", "text/plain; charset=" + encoding); 
    234285            msg.setHeader("Content-Transfer-Encoding", "8bit"); 
    235286             
     
    246297             
    247298            msg.setRecipients(Message.RecipientType.TO, toaddresses); 
    248             msg.setSubject(subject, CHARSET); 
     299            msg.setSubject(subject, encoding); 
    249300            msg.setFrom(fromaddress); 
    250301            msg.setSentDate(new Date()); 
     
    305356        } 
    306357    } 
    307  
     358     
    308359}