DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28485>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28485

Cannot change SMTP in MailMessageSender after first initialisation of Session

           Summary: Cannot change SMTP in MailMessageSender after first
                    initialisation of Session
           Product: Cocoon 2
           Version: 2.1.4
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: blocks
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


The following works fine :

>org.apache.cocoon.mail.MailMessageSender _sendmail_mms =
>                new org.apache.cocoon.mail.MailMessageSender("myMailServer1");

but when I want to use another SMTPHost :

>org.apache.cocoon.mail.MailMessageSender _sendmail_mms =
>                new org.apache.cocoon.mail.MailMessageSender("myMailServer2");

it still uses myMailServer1.

>From what I can see, it is because it passes the SMTPHost in a Properties 
object (within java/org/apache/cocoon/mail/MailMessageSender.java) and a 
session is created using that properties object with 
javax.mail.Session.getDefaultInstance(properties). getDefaultInstance only uses 
the properties argument (which has the new SMTPHost) if Session has never been 
created (which it has from the first constructor).

In order to use a different SMTPHost, we're having to restart.

Please help :o)

Reply via email to