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=30946>. 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=30946 [email] - being able to specify the port number Summary: [email] - being able to specify the port number Product: Commons Version: unspecified Platform: Other OS/Version: Other Status: NEW Severity: Enhancement Priority: Other Component: Sandbox AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] I needed to be able to do this: SimpleEmail email = new SimpleEmail(); email.setHostName("mail.myserver.com"); email.setPortNumber(2500); Here's the patch. phil. Index: Email.java =================================================================== RCS file: /home/cvspublic/jakarta-commons-sandbox/email/src/java/org/apache/commons/mail/Email.java,v retrieving revision 1.16 diff -u -r1.16 Email.java --- Email.java 27 Aug 2004 11:43:14 -0000 1.16 +++ Email.java 30 Aug 2004 20:32:59 -0000 @@ -59,6 +59,7 @@ public static final String CONTENT_TYPE = "content.type"; public static final String MAIL_HOST = "mail.host"; + public static final String MAIL_PORT = "mail.smtp.port"; public static final String MAIL_SMTP_FROM = "mail.smtp.from"; public static final String MAIL_SMTP_AUTH = "mail.smtp.auth"; public static final String MAIL_TRANSPORT_PROTOCOL = "mail.transport.protocol"; @@ -111,6 +112,11 @@ * to get property from system.properties. If still null, quit */ private String hostName = null; + + /** + * The port number of the mail server to connect to. Defaults to the standard port (25). + */ + private String portNumber = "25"; /** List of "to" email adresses */ private ArrayList toList = null; @@ -242,6 +248,16 @@ { this.hostName = aHostName; } + + + /** + * Set the port number of the outgoing mail server. + * @param aPortNumber + */ + public void setPortNumber(int aPortNumber) + { + this.portNumber = new Integer(aPortNumber).toString(); + } /** * Initialise a mailsession object @@ -264,7 +280,8 @@ throw new MessagingException( "Cannot find valid hostname for mail session"); } - + + properties.setProperty(MAIL_PORT, portNumber); properties.setProperty(MAIL_HOST, hostName); properties.setProperty(MAIL_DEBUG,new Boolean(this.debug).toString()); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
