voodoodyne / subethasmtp

SubEtha SMTP is a Java library for receiving SMTP mail
Other
352 stars 139 forks source link

Requires mailapi.jar, no log of failure #41

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The documentation claims that the only dependency is slf4j, but this is false. 
org.subethamail.smtp.util.EmailUtils depends on javax.mail.internet classes, 
which are in mailapi.jar.

This was hard to find because Session.run() doesn't catch and log exceptions - 
the thread just silently dies.

DEBUG - Client: MAIL FROM:<bay1@blahblah.com> SIZE=431
Exception in thread "org.subethamail.smtp.server.Session-/192.168.109.1:44544" 
java.lang.NoClassDefFoundError: javax/mail/internet/AddressException
    at org.subethamail.smtp.command.MailCommand.execute(MailCommand.java:56)
    at org.subethamail.smtp.server.RequireTLSCommandWrapper.execute(RequireTLSCommandWrapper.java:27)
    at org.subethamail.smtp.server.CommandHandler.handleCommand(CommandHandler.java:78)
    at org.subethamail.smtp.server.Session.run(Session.java:149)
Caused by: java.lang.ClassNotFoundException: 
javax.mail.internet.AddressException
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    ... 4 more

Original issue reported on code.google.com by kern...@gmail.com on 10 Mar 2011 at 6:01

GoogleCodeExporter commented 9 years ago
This is odd. Either the dependency should be removed or it should be documented.

Original comment by latch...@gmail.com on 11 Mar 2011 at 12:40

GoogleCodeExporter commented 9 years ago
The dependency cannot be entirely removed because Wiser use it for important 
purpose, it makes the received mail available in parsed form using JavaMail. 
So, at least for testing with Wiser JavaMail is definitely required. However, 
it could be made optional, because the main functionality of the library, i.e. 
receiving mails, only uses JavaMail at one place. It checks the syntax of the 
reverse path, as supplied by the MAIL FROM command. This can be replaced by 
borrowing a similar class from Apacha James for example.

Original comment by hontvari@flyordie.com on 14 Mar 2011 at 9:57

GoogleCodeExporter commented 9 years ago
My recent commit adds logging of such exceptions (and RuntimeExceptions too), I 
added JavaMail as a dependency on the Wiki page.

Original comment by hontvari@flyordie.com on 14 Mar 2011 at 10:03

GoogleCodeExporter commented 9 years ago
I'd like to remove the javamail dependency from subethasmtp core, but I'm 
swamped right now.  Maybe in the next couple days.

Original comment by lhori...@gmail.com on 14 Mar 2011 at 10:08