commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 38538] New: - Bad Exception message when using a supplied MailSession
Date Mon, 06 Feb 2006 20:56:47 GMT
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=38538>.
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=38538

           Summary: Bad Exception message when using a supplied MailSession
           Product: Commons
           Version: 1.0 Final
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Email
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: cdeal@csc.com


I create a MultiPartEmail object and supply a javax.mail.Session as a param to 
the setMailSession() method.  I do not explicitly set the hostname or port.  
After stting the rest of the desired/required fields, I call send().

I happened to have a javax.mail.MessagingException get thrown which was caught 
in Email, specifically, sendMimeMessage().  What I noticed was that the 
stacktrace in my log read the following:

org.apache.commons.mail.EmailException: Sending the email to the following 
server failed : null:25
	at org.apache.commons.mail.Email.sendMimeMessage(Email.java:873)
	at org.apache.commons.mail.Email.send(Email.java:898)
	at com.csc.aims.util.jobs.SendMailJob.sendEmail(SendMailJob.java:219)
	at com.csc.aims.util.jobs.SendMailJob.execute(SendMailJob.java:186)
	at org.quartz.core.JobRunShell.run(JobRunShell.java:195)
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run
(SimpleThreadPool.java:520)
Caused by: javax.mail.MessagingException: Could not connect to SMTP host: 
smtp.server.address, port: 25;
  nested exception is:
	java.net.ConnectException: Connection refused: connect
	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1213)
	at com.sun.mail.smtp.SMTPTransport.protocolConnect
(SMTPTransport.java:311)
	at javax.mail.Service.connect(Service.java:233)
	at javax.mail.Service.connect(Service.java:134)
	at javax.mail.Service.connect(Service.java:86)
	at com.sun.mail.smtp.SMTPTransport.connect(SMTPTransport.java:144)
	at javax.mail.Transport.send0(Transport.java:150)
	at javax.mail.Transport.send(Transport.java:80)
	at org.apache.commons.mail.Email.sendMimeMessage(Email.java:863)
	... 5 more

As can be seen, the MessagingException knows the hostname (hostname changed to 
protect the innocent :), yet the EmailException does not.  After taking a 
closer look, the str that is generated for the Exception message uses the 
hostname property, yet upon tracing the code, the hostname never gets set by 
this code execution path.  

My expectation was that since I supplied a valid Session object (with 
hostname) that the Email class would be able to extract that info back out of 
it.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message