Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.0, 1.1, 1.2
-
None
-
Windows XP, JRE 1.6.0_16, JavaMail 1.4.1, Commons Email 1.2 [latest from svn], jaf 1.1.1
Description
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
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.
Attachments
Attachments
Issue Links
- is duplicated by
-
EMAIL-123 Misleading exception message
- Closed