Geekzone: technology news, blogs, forums
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.

14885 posts

Uber Geek
+1 received by user: 2794


# 106293 21-Jul-2012 08:43
Send private message

I'm writing a Spring/Java/Tomcat app, and I'm having a problem with getting it to send email. I can send email fine from a given piece of code when run as a standalone Java application, but when it runs within Tomcat it runs fine but Javamail doesn't work properly, throws an error at the start of the email conversation. I think I may have narrowed it down to multiple javamail implementations, but I'm not sure yet, but I'm still seeing something a bit bizzare.

The most bizarre part is the email server isn't behaving as I'd expect when I telnet to the server (try it youserlf) - the first EHLO or HELO is always sent a 500 unrecognised command reply, but exactly the same command repeated works. ESMTP Exim 4.77 #2 Fri, 20 Jul 2012 15:18:52 -0500
220-We do not authorize the use of this system to transport unsolicited,
220 and/or bulk e-mail.
500 unrecognized command
EHLO Hello [my IP removed]
250-SIZE 52428800
250 HELP

And another session ESMTP Exim 4.77 #2 Fri, 20 Jul 2012 15:20:10 -0500
220-We do not authorize the use of this system to transport unsolicited,
220 and/or bulk e-mail.
500 unrecognized command
250 Hello [my IP removed]

Here's the logs from tomcat which show much the same thing

DEBUG: getProvider() returning provider protocol=smtp; type=javax.mail.Provider$Type@62e26a4a;.apache.geronimo.javamail.transport.smtp.SMTPTransport; vendor=Apache Software Foundation;version=1.0
SMTPTransport DEBUG: Connecting to server for user (removed)
SMTPTransport DEBUG: Attempting plain socket connection to server (removed):25 ESMTP Exim 4.77 #2 Fri, 20 Jul 2012 15:28:20 -0500
>>>>>Sending data EHLO (removed)<<<<<<
EHLO (removed)
220-We do not authorize the use of this system to transport unsolicited,
>>>>>Sending data HELO (removed)<<<<<<
HELO (removed)
220 and/or bulk e-mail.

The thing that throws me is telnetting to the SMTP port gives me the same failure as Javamail gets running inside tomcat, but running as an app it works fine.

I know a little about email, I wrote an email server about ten years ago, nothing commercial just a university project, but I'm not an email expert. Any thoughts or ideas?

Create new topic


10815 posts

Uber Geek
+1 received by user: 1810

  # 659795 22-Jul-2012 09:31
Send private message

Any difference if you use the ip address of the mail server?

14885 posts

Uber Geek
+1 received by user: 2794


  # 659796 22-Jul-2012 09:34
Send private message

Nope. I discovered that if you use telnet connection type this happens, if you use a raw connection type (in putty) the problem goes away.

I also tracked down the Java problem. EclipseLink depends on a library that depends on another JavaMail implementation, so I need to get JavaMail onto the Tomcat classpath before that. It's proving to be weird though, class loading inside tomcat's a pita.

Create new topic

Twitter and LinkedIn »

Follow us to receive Twitter updates when new discussions are posted in our forums:

Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:

Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:

News »

Dunedin selects Telensa to deliver smart street lighting for 15,000 LEDs
Posted 18-Jul-2019 10:21

Sprint announces a connected wallet card with built-in IoT support
Posted 18-Jul-2019 08:36

Educational tool developed at Otago makes international launch
Posted 17-Jul-2019 21:57

Symantec introduces cloud access security solution
Posted 17-Jul-2019 21:48

New Zealand government unveils new digital service to make business easier
Posted 16-Jul-2019 17:35

Scientists unveil image of quantum entanglement
Posted 13-Jul-2019 06:00

Hackers to be challenged at University of Waikato
Posted 12-Jul-2019 21:34

OPPO Reno Z now available in New Zealand
Posted 12-Jul-2019 21:28

Sony introduces WF-1000XM3 wireless headphones with noise cancellation
Posted 8-Jul-2019 16:56

Xero announces new smarter tools, push into the North American market
Posted 19-Jun-2019 17:20

New report by Unisys shows New Zealanders want action by social platform companies and police to monitor social media sites
Posted 19-Jun-2019 17:09

ASB adds Google Pay option to contactless payments
Posted 19-Jun-2019 17:05

New Zealand PC Market declines on the back of high channel inventory, IDC reports
Posted 18-Jun-2019 17:35

Air New Zealand uses drones to inspect aircraft
Posted 17-Jun-2019 15:39

TCL Electronics launches its first-ever 8K TV
Posted 17-Jun-2019 15:18

Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.

Support Geekzone »

Our community of supporters help make Geekzone possible. Click the button below to join them.

Support Geezone on PressPatron

Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.