You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Kevin Lester (JIRA)" <ji...@apache.org> on 2009/11/08 02:00:34 UTC

[jira] Created: (EMAIL-91) Incorrect SMTP Port number shown in error message when an email fails to send due to a blocked port and SSL is used.

Incorrect SMTP Port number shown in error message when an email fails to send due to a blocked port and SSL is used.
--------------------------------------------------------------------------------------------------------------------

                 Key: EMAIL-91
                 URL: https://issues.apache.org/jira/browse/EMAIL-91
             Project: Commons Email
          Issue Type: Bug
    Affects Versions: 1.1, 1.0, 1.2
         Environment: Windows XP, JRE 1.6.0_16, JavaMail 1.4.1, Commons Email 1.2 [latest from svn], jaf 1.1.1
            Reporter: Kevin Lester
            Priority: Minor


An incorrect error message is being returned from the email class when a message fails to send due to a blocked port and SSL is specified.  Specificaly, the port number in the error message is incorrect; it will show the stmp port that is set on the object (normally 25), when it should be showing the port that was set in the session when the session was created [465 when SSL is used].

This issue is only visible to the user if the email fails to send because the SSL port is blocked.

The following code reproduces the issue:
	public void testErrorMessage(){
		HtmlEmail email = new HtmlEmail();
		try {
			email.addTo("abc@d.com");
			email.setSubject("Testing Apache Error message ");
			email.setFrom("abc@d.com");
			email.setMsg("Sending through gmail");
			email.setSSL(true);
			email.setHostName("anyhost.com");
			email.send();
		} catch (EmailException e) {
			e.printStackTrace();
		}
	}

If port 465 is blocked, then you wil ge the following stacktrace:

org.apache.commons.mail.EmailException: Sending the email to the following server failed : anyhost.com:25
	at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1138)
	at org.apache.commons.mail.Email.send(Email.java:1163)
	at EmailTester.testErrorMessage(EmailTester.java:27)
	at EmailTester.main(EmailTester.java:14)
Caused by: javax.mail.MessagingException: Could not connect to SMTP host: anyhost.com, port: 465;
  nested exception is:
	java.net.ConnectException: Connection refused: connect
	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391)
	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
	at javax.mail.Service.connect(Service.java:288)
                      ...

Note that the port is listed correctly in the inner exception, but it is incorrect in the topmost exception.

I have fixed this issue in my sandbox, and will attach the patch to this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (EMAIL-91) Incorrect SMTP Port number shown in error message when an email fails to send due to a blocked port and SSL is used.

Posted by "Siegfried Goeschl (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/EMAIL-91?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Siegfried Goeschl updated EMAIL-91:
-----------------------------------

    Comment: was deleted

(was: Hi Kevin,

just looking the patch and would like to keep you in the loop

+) in Email#getSmtpPort you checked for MAIL_HOST before accessing MAIL_PORT

+) the MultiPartEmailTest#testAttachmentFileSize and #testAttachmentURLSize fail on Mac OS X (M2 and IntelliJ)  with >>>Cannot attach file "Users/siegfriedgoeschl/work/asf/commons/proper/email/trunk/target/test-classes/images/asf_logo_wide.gif"<<< which is entirely correct since there is no leading slash. When adding the slash the tests are passing)

> Incorrect SMTP Port number shown in error message when an email fails to send due to a blocked port and SSL is used.
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: EMAIL-91
>                 URL: https://issues.apache.org/jira/browse/EMAIL-91
>             Project: Commons Email
>          Issue Type: Bug
>    Affects Versions: 1.0, 1.1, 1.2
>         Environment: Windows XP, JRE 1.6.0_16, JavaMail 1.4.1, Commons Email 1.2 [latest from svn], jaf 1.1.1
>            Reporter: Kevin Lester
>            Assignee: Siegfried Goeschl
>            Priority: Minor
>         Attachments: issue-91_patch.txt
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> An incorrect error message is being returned from the email class when a message fails to send due to a blocked port and SSL is specified.  Specificaly, the port number in the error message is incorrect; it will show the stmp port that is set on the object (normally 25), when it should be showing the port that was set in the session when the session was created [465 when SSL is used].
> This issue is only visible to the user if the email fails to send because the SSL port is blocked.
> The following code reproduces the issue:
> 	public void testErrorMessage(){
> 		HtmlEmail email = new HtmlEmail();
> 		try {
> 			email.addTo("abc@d.com");
> 			email.setSubject("Testing Apache Error message ");
> 			email.setFrom("abc@d.com");
> 			email.setMsg("Sending through gmail");
> 			email.setSSL(true);
> 			email.setHostName("anyhost.com");
> 			email.send();
> 		} catch (EmailException e) {
> 			e.printStackTrace();
> 		}
> 	}
> If port 465 is blocked, then you wil ge the following stacktrace:
> org.apache.commons.mail.EmailException: Sending the email to the following server failed : anyhost.com:25
> 	at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1138)
> 	at org.apache.commons.mail.Email.send(Email.java:1163)
> 	at EmailTester.testErrorMessage(EmailTester.java:27)
> 	at EmailTester.main(EmailTester.java:14)
> Caused by: javax.mail.MessagingException: Could not connect to SMTP host: anyhost.com, port: 465;
>   nested exception is:
> 	java.net.ConnectException: Connection refused: connect
> 	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391)
> 	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
> 	at javax.mail.Service.connect(Service.java:288)
>                       ...
> Note that the port is listed correctly in the inner exception, but it is incorrect in the topmost exception.
> I have fixed this issue in my sandbox, and will attach the patch to this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (EMAIL-91) Incorrect SMTP Port number shown in error message when an email fails to send due to a blocked port and SSL is used.

Posted by "Siegfried Goeschl (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/EMAIL-91?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Siegfried Goeschl resolved EMAIL-91.
------------------------------------

    Resolution: Fixed

Applied the corrected patch and made local tests

> Incorrect SMTP Port number shown in error message when an email fails to send due to a blocked port and SSL is used.
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: EMAIL-91
>                 URL: https://issues.apache.org/jira/browse/EMAIL-91
>             Project: Commons Email
>          Issue Type: Bug
>    Affects Versions: 1.0, 1.1, 1.2
>         Environment: Windows XP, JRE 1.6.0_16, JavaMail 1.4.1, Commons Email 1.2 [latest from svn], jaf 1.1.1
>            Reporter: Kevin Lester
>            Assignee: Siegfried Goeschl
>            Priority: Minor
>             Fix For: 1.3
>
>         Attachments: issue-91_patch.txt, issue-91a_patch.txt
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> An incorrect error message is being returned from the email class when a message fails to send due to a blocked port and SSL is specified.  Specificaly, the port number in the error message is incorrect; it will show the stmp port that is set on the object (normally 25), when it should be showing the port that was set in the session when the session was created [465 when SSL is used].
> This issue is only visible to the user if the email fails to send because the SSL port is blocked.
> The following code reproduces the issue:
> 	public void testErrorMessage(){
> 		HtmlEmail email = new HtmlEmail();
> 		try {
> 			email.addTo("abc@d.com");
> 			email.setSubject("Testing Apache Error message ");
> 			email.setFrom("abc@d.com");
> 			email.setMsg("Sending through gmail");
> 			email.setSSL(true);
> 			email.setHostName("anyhost.com");
> 			email.send();
> 		} catch (EmailException e) {
> 			e.printStackTrace();
> 		}
> 	}
> If port 465 is blocked, then you wil ge the following stacktrace:
> org.apache.commons.mail.EmailException: Sending the email to the following server failed : anyhost.com:25
> 	at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1138)
> 	at org.apache.commons.mail.Email.send(Email.java:1163)
> 	at EmailTester.testErrorMessage(EmailTester.java:27)
> 	at EmailTester.main(EmailTester.java:14)
> Caused by: javax.mail.MessagingException: Could not connect to SMTP host: anyhost.com, port: 465;
>   nested exception is:
> 	java.net.ConnectException: Connection refused: connect
> 	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391)
> 	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
> 	at javax.mail.Service.connect(Service.java:288)
>                       ...
> Note that the port is listed correctly in the inner exception, but it is incorrect in the topmost exception.
> I have fixed this issue in my sandbox, and will attach the patch to this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (EMAIL-91) Incorrect SMTP Port number shown in error message when an email fails to send due to a blocked port and SSL is used.

Posted by "Siegfried Goeschl (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/EMAIL-91?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Siegfried Goeschl updated EMAIL-91:
-----------------------------------

    Fix Version/s: 1.3

> Incorrect SMTP Port number shown in error message when an email fails to send due to a blocked port and SSL is used.
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: EMAIL-91
>                 URL: https://issues.apache.org/jira/browse/EMAIL-91
>             Project: Commons Email
>          Issue Type: Bug
>    Affects Versions: 1.0, 1.1, 1.2
>         Environment: Windows XP, JRE 1.6.0_16, JavaMail 1.4.1, Commons Email 1.2 [latest from svn], jaf 1.1.1
>            Reporter: Kevin Lester
>            Assignee: Siegfried Goeschl
>            Priority: Minor
>             Fix For: 1.3
>
>         Attachments: issue-91_patch.txt, issue-91a_patch.txt
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> An incorrect error message is being returned from the email class when a message fails to send due to a blocked port and SSL is specified.  Specificaly, the port number in the error message is incorrect; it will show the stmp port that is set on the object (normally 25), when it should be showing the port that was set in the session when the session was created [465 when SSL is used].
> This issue is only visible to the user if the email fails to send because the SSL port is blocked.
> The following code reproduces the issue:
> 	public void testErrorMessage(){
> 		HtmlEmail email = new HtmlEmail();
> 		try {
> 			email.addTo("abc@d.com");
> 			email.setSubject("Testing Apache Error message ");
> 			email.setFrom("abc@d.com");
> 			email.setMsg("Sending through gmail");
> 			email.setSSL(true);
> 			email.setHostName("anyhost.com");
> 			email.send();
> 		} catch (EmailException e) {
> 			e.printStackTrace();
> 		}
> 	}
> If port 465 is blocked, then you wil ge the following stacktrace:
> org.apache.commons.mail.EmailException: Sending the email to the following server failed : anyhost.com:25
> 	at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1138)
> 	at org.apache.commons.mail.Email.send(Email.java:1163)
> 	at EmailTester.testErrorMessage(EmailTester.java:27)
> 	at EmailTester.main(EmailTester.java:14)
> Caused by: javax.mail.MessagingException: Could not connect to SMTP host: anyhost.com, port: 465;
>   nested exception is:
> 	java.net.ConnectException: Connection refused: connect
> 	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391)
> 	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
> 	at javax.mail.Service.connect(Service.java:288)
>                       ...
> Note that the port is listed correctly in the inner exception, but it is incorrect in the topmost exception.
> I have fixed this issue in my sandbox, and will attach the patch to this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (EMAIL-91) Incorrect SMTP Port number shown in error message when an email fails to send due to a blocked port and SSL is used.

Posted by "Siegfried Goeschl (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/EMAIL-91?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12867180#action_12867180 ] 

Siegfried Goeschl edited comment on EMAIL-91 at 5/13/10 1:07 PM:
-----------------------------------------------------------------

Corrected patch (issue-91a_patch.txt)

      was (Author: sgoeschl):
    Corrected patch
  
> Incorrect SMTP Port number shown in error message when an email fails to send due to a blocked port and SSL is used.
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: EMAIL-91
>                 URL: https://issues.apache.org/jira/browse/EMAIL-91
>             Project: Commons Email
>          Issue Type: Bug
>    Affects Versions: 1.0, 1.1, 1.2
>         Environment: Windows XP, JRE 1.6.0_16, JavaMail 1.4.1, Commons Email 1.2 [latest from svn], jaf 1.1.1
>            Reporter: Kevin Lester
>            Assignee: Siegfried Goeschl
>            Priority: Minor
>         Attachments: issue-91_patch.txt, issue-91a_patch.txt
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> An incorrect error message is being returned from the email class when a message fails to send due to a blocked port and SSL is specified.  Specificaly, the port number in the error message is incorrect; it will show the stmp port that is set on the object (normally 25), when it should be showing the port that was set in the session when the session was created [465 when SSL is used].
> This issue is only visible to the user if the email fails to send because the SSL port is blocked.
> The following code reproduces the issue:
> 	public void testErrorMessage(){
> 		HtmlEmail email = new HtmlEmail();
> 		try {
> 			email.addTo("abc@d.com");
> 			email.setSubject("Testing Apache Error message ");
> 			email.setFrom("abc@d.com");
> 			email.setMsg("Sending through gmail");
> 			email.setSSL(true);
> 			email.setHostName("anyhost.com");
> 			email.send();
> 		} catch (EmailException e) {
> 			e.printStackTrace();
> 		}
> 	}
> If port 465 is blocked, then you wil ge the following stacktrace:
> org.apache.commons.mail.EmailException: Sending the email to the following server failed : anyhost.com:25
> 	at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1138)
> 	at org.apache.commons.mail.Email.send(Email.java:1163)
> 	at EmailTester.testErrorMessage(EmailTester.java:27)
> 	at EmailTester.main(EmailTester.java:14)
> Caused by: javax.mail.MessagingException: Could not connect to SMTP host: anyhost.com, port: 465;
>   nested exception is:
> 	java.net.ConnectException: Connection refused: connect
> 	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391)
> 	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
> 	at javax.mail.Service.connect(Service.java:288)
>                       ...
> Note that the port is listed correctly in the inner exception, but it is incorrect in the topmost exception.
> I have fixed this issue in my sandbox, and will attach the patch to this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (EMAIL-91) Incorrect SMTP Port number shown in error message when an email fails to send due to a blocked port and SSL is used.

Posted by "Kevin Lester (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/EMAIL-91?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kevin Lester updated EMAIL-91:
------------------------------

    Attachment: issue-91_patch.txt

This patch addresses this issue by modifying the getSmtpPort, getSslSmtpPort, and getHostName methods.  These methods currently look in the Email object's instance variables to get the port, ssl port, and hostname values.  If the values are not set in the instance variables, then it looks for them in the session.

I have modified these methods to do the lookup in the reverse order: first they look in the session, then they look in the instance variables.  So these methods should now return the exact values that were used when the email tried to send.

This patch was taken against the latest code, and all unit tests pass.

> Incorrect SMTP Port number shown in error message when an email fails to send due to a blocked port and SSL is used.
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: EMAIL-91
>                 URL: https://issues.apache.org/jira/browse/EMAIL-91
>             Project: Commons Email
>          Issue Type: Bug
>    Affects Versions: 1.0, 1.1, 1.2
>         Environment: Windows XP, JRE 1.6.0_16, JavaMail 1.4.1, Commons Email 1.2 [latest from svn], jaf 1.1.1
>            Reporter: Kevin Lester
>            Priority: Minor
>         Attachments: issue-91_patch.txt
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> An incorrect error message is being returned from the email class when a message fails to send due to a blocked port and SSL is specified.  Specificaly, the port number in the error message is incorrect; it will show the stmp port that is set on the object (normally 25), when it should be showing the port that was set in the session when the session was created [465 when SSL is used].
> This issue is only visible to the user if the email fails to send because the SSL port is blocked.
> The following code reproduces the issue:
> 	public void testErrorMessage(){
> 		HtmlEmail email = new HtmlEmail();
> 		try {
> 			email.addTo("abc@d.com");
> 			email.setSubject("Testing Apache Error message ");
> 			email.setFrom("abc@d.com");
> 			email.setMsg("Sending through gmail");
> 			email.setSSL(true);
> 			email.setHostName("anyhost.com");
> 			email.send();
> 		} catch (EmailException e) {
> 			e.printStackTrace();
> 		}
> 	}
> If port 465 is blocked, then you wil ge the following stacktrace:
> org.apache.commons.mail.EmailException: Sending the email to the following server failed : anyhost.com:25
> 	at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1138)
> 	at org.apache.commons.mail.Email.send(Email.java:1163)
> 	at EmailTester.testErrorMessage(EmailTester.java:27)
> 	at EmailTester.main(EmailTester.java:14)
> Caused by: javax.mail.MessagingException: Could not connect to SMTP host: anyhost.com, port: 465;
>   nested exception is:
> 	java.net.ConnectException: Connection refused: connect
> 	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391)
> 	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
> 	at javax.mail.Service.connect(Service.java:288)
>                       ...
> Note that the port is listed correctly in the inner exception, but it is incorrect in the topmost exception.
> I have fixed this issue in my sandbox, and will attach the patch to this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (EMAIL-91) Incorrect SMTP Port number shown in error message when an email fails to send due to a blocked port and SSL is used.

Posted by "Siegfried Goeschl (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/EMAIL-91?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12867169#action_12867169 ] 

Siegfried Goeschl commented on EMAIL-91:
----------------------------------------

Hi Kevin,

just looking the patch and would like to keep you in the loop

+) in Email#getSmtpPort you checked for MAIL_HOST before accessing MAIL_PORT

+) the MultiPartEmailTest#testAttachmentFileSize and #testAttachmentURLSize fail on Mac OS X (M2 and IntelliJ)  with >>>Cannot attach file "Users/siegfriedgoeschl/work/asf/commons/proper/email/trunk/target/test-classes/images/asf_logo_wide.gif"<<< which is entirely correct since there is no leading slash. When adding the slash the tests are passing

> Incorrect SMTP Port number shown in error message when an email fails to send due to a blocked port and SSL is used.
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: EMAIL-91
>                 URL: https://issues.apache.org/jira/browse/EMAIL-91
>             Project: Commons Email
>          Issue Type: Bug
>    Affects Versions: 1.0, 1.1, 1.2
>         Environment: Windows XP, JRE 1.6.0_16, JavaMail 1.4.1, Commons Email 1.2 [latest from svn], jaf 1.1.1
>            Reporter: Kevin Lester
>            Assignee: Siegfried Goeschl
>            Priority: Minor
>         Attachments: issue-91_patch.txt
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> An incorrect error message is being returned from the email class when a message fails to send due to a blocked port and SSL is specified.  Specificaly, the port number in the error message is incorrect; it will show the stmp port that is set on the object (normally 25), when it should be showing the port that was set in the session when the session was created [465 when SSL is used].
> This issue is only visible to the user if the email fails to send because the SSL port is blocked.
> The following code reproduces the issue:
> 	public void testErrorMessage(){
> 		HtmlEmail email = new HtmlEmail();
> 		try {
> 			email.addTo("abc@d.com");
> 			email.setSubject("Testing Apache Error message ");
> 			email.setFrom("abc@d.com");
> 			email.setMsg("Sending through gmail");
> 			email.setSSL(true);
> 			email.setHostName("anyhost.com");
> 			email.send();
> 		} catch (EmailException e) {
> 			e.printStackTrace();
> 		}
> 	}
> If port 465 is blocked, then you wil ge the following stacktrace:
> org.apache.commons.mail.EmailException: Sending the email to the following server failed : anyhost.com:25
> 	at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1138)
> 	at org.apache.commons.mail.Email.send(Email.java:1163)
> 	at EmailTester.testErrorMessage(EmailTester.java:27)
> 	at EmailTester.main(EmailTester.java:14)
> Caused by: javax.mail.MessagingException: Could not connect to SMTP host: anyhost.com, port: 465;
>   nested exception is:
> 	java.net.ConnectException: Connection refused: connect
> 	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391)
> 	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
> 	at javax.mail.Service.connect(Service.java:288)
>                       ...
> Note that the port is listed correctly in the inner exception, but it is incorrect in the topmost exception.
> I have fixed this issue in my sandbox, and will attach the patch to this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (EMAIL-91) Incorrect SMTP Port number shown in error message when an email fails to send due to a blocked port and SSL is used.

Posted by "Siegfried Goeschl (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/EMAIL-91?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Siegfried Goeschl updated EMAIL-91:
-----------------------------------

    Attachment: issue-91a_patch.txt

Corrected patch

> Incorrect SMTP Port number shown in error message when an email fails to send due to a blocked port and SSL is used.
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: EMAIL-91
>                 URL: https://issues.apache.org/jira/browse/EMAIL-91
>             Project: Commons Email
>          Issue Type: Bug
>    Affects Versions: 1.0, 1.1, 1.2
>         Environment: Windows XP, JRE 1.6.0_16, JavaMail 1.4.1, Commons Email 1.2 [latest from svn], jaf 1.1.1
>            Reporter: Kevin Lester
>            Assignee: Siegfried Goeschl
>            Priority: Minor
>         Attachments: issue-91_patch.txt, issue-91a_patch.txt
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> An incorrect error message is being returned from the email class when a message fails to send due to a blocked port and SSL is specified.  Specificaly, the port number in the error message is incorrect; it will show the stmp port that is set on the object (normally 25), when it should be showing the port that was set in the session when the session was created [465 when SSL is used].
> This issue is only visible to the user if the email fails to send because the SSL port is blocked.
> The following code reproduces the issue:
> 	public void testErrorMessage(){
> 		HtmlEmail email = new HtmlEmail();
> 		try {
> 			email.addTo("abc@d.com");
> 			email.setSubject("Testing Apache Error message ");
> 			email.setFrom("abc@d.com");
> 			email.setMsg("Sending through gmail");
> 			email.setSSL(true);
> 			email.setHostName("anyhost.com");
> 			email.send();
> 		} catch (EmailException e) {
> 			e.printStackTrace();
> 		}
> 	}
> If port 465 is blocked, then you wil ge the following stacktrace:
> org.apache.commons.mail.EmailException: Sending the email to the following server failed : anyhost.com:25
> 	at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1138)
> 	at org.apache.commons.mail.Email.send(Email.java:1163)
> 	at EmailTester.testErrorMessage(EmailTester.java:27)
> 	at EmailTester.main(EmailTester.java:14)
> Caused by: javax.mail.MessagingException: Could not connect to SMTP host: anyhost.com, port: 465;
>   nested exception is:
> 	java.net.ConnectException: Connection refused: connect
> 	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1391)
> 	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:412)
> 	at javax.mail.Service.connect(Service.java:288)
>                       ...
> Note that the port is listed correctly in the inner exception, but it is incorrect in the topmost exception.
> I have fixed this issue in my sandbox, and will attach the patch to this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.