commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Siegfried Goeschl (JIRA)" <>
Subject [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.
Date Thu, 13 May 2010 16:47:43 GMT


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:
>             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("");
> 			email.setSubject("Testing Apache Error message ");
> 			email.setFrom("");
> 			email.setMsg("Sending through gmail");
> 			email.setSSL(true);
> 			email.setHostName("");
> 			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
> 	at org.apache.commons.mail.Email.sendMimeMessage(
> 	at org.apache.commons.mail.Email.send(
> 	at EmailTester.testErrorMessage(
> 	at EmailTester.main(
> Caused by: javax.mail.MessagingException: Could not connect to SMTP host:,
port: 465;
>   nested exception is:
> Connection refused: connect
> 	at com.sun.mail.smtp.SMTPTransport.openServer(
> 	at com.sun.mail.smtp.SMTPTransport.protocolConnect(
> 	at javax.mail.Service.connect(
>                       ...
> 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.

View raw message