Author: sgoeschl Date: Tue Feb 24 22:31:24 2009 New Revision: 747585 URL: http://svn.apache.org/viewvc?rev=747585&view=rev Log: [EMAIL-74] Create an overridable method in Email.java to create the MimeMessage instance.
Modified: commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java commons/proper/email/trunk/xdocs/changes.xml Modified: commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java?rev=747585&r1=747584&r2=747585&view=diff ============================================================================== --- commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java (original) +++ commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java Tue Feb 24 22:31:24 2009 @@ -1026,7 +1026,7 @@ try { this.getMailSession(); - this.message = new MimeMessage(this.session); + this.message = this.createMimeMessage(this.session); if (EmailUtils.isNotEmpty(this.subject)) { @@ -1131,6 +1131,18 @@ } /** + * Factory method to create a customized MimeMessage which can be + * implemented by a derived class, e.g. to set the message id. + * + * @param aSession mail session to be used + * @return the newly created message + */ + protected MimeMessage createMimeMessage(Session aSession) + { + return new MimeMessage(aSession); + } + + /** * Sends the previously created MimeMessage to the SMTP server. * * @return the message id of the underlying MimeMessage Modified: commons/proper/email/trunk/xdocs/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/xdocs/changes.xml?rev=747585&r1=747584&r2=747585&view=diff ============================================================================== --- commons/proper/email/trunk/xdocs/changes.xml (original) +++ commons/proper/email/trunk/xdocs/changes.xml Tue Feb 24 22:31:24 2009 @@ -24,11 +24,14 @@ <body> <release version="1.2-SNAPSHOT" date="as in SVN"> + <action dev="sgoeschl" type="fix" issue="EMAIL-74" date="2009-02-22" due-to="Jim McCabe, Corey Scott"> + Create an overridable method in Email.java to create the MimeMessage instance. + </action> <action dev="sgoeschl" type="fix" issue="EMAIL-71" date="2009-02-22" due-to="Teemu Lang, Corey Scott"> If setHostName() has not been called, getHostName() tries to return this.session.getProperty(MAIL_HOST). If mail session has not been - created yet, this will throw a NullPointerException. Now getHostName() - checks that this.session is not null before trying to access it. + created yet, this will throw a NullPointerException. Now getHostName() + checks that this.session is not null before trying to access it. </action> <action dev="sgoeschl" type="fix" issue="EMAIL-81" date="2009-02-22" due-to="Travis Reader, Corey Scott"> Add getTo and getReplyTo to Email class.