• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3485
  • Last Modified:

Unable to send email on linux server using postfix and tomcat application

Hi ,
We have a linux server with postfix as mail server,
We are able to send emails from the command, we are able to telnet and send emails fine with no authentication , however the tomcat app we are running is failing with this error below.


2012-09-12 17:22:28,961 ERROR [Timer-3] (MailUtil.java:250) - com.livex.mail.util.MailUtil@e44e79
org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException: 535 5.7.8 Error: authentication failed: generic failure

 at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:392)
 at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:340)
 at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:336)
 at com.livex.mail.util.MailUtil.sendMail(MailUtil.java:248)
 at com.livex.web.util.trade.TradeConfirmationMailUtilImpl.sendTradeConfirmationMail(TradeConfirmationMailUtilImpl.java:181)
 at com.livex.util.trade.TradeChargesAndEmailTask.generateCommissionChargesAndEmail(TradeChargesAndEmailTask.java:210)
 at com.livex.util.trade.TradeChargesAndEmailTask.createCommissionChgAndEmail(TradeChargesAndEmailTask.java:159)
 at com.livex.util.trade.TradeChargesAndEmailTask.run(TradeChargesAndEmailTask.java:118)
 at java.util.TimerThread.mainLoop(Timer.java:512)
 at java.util.TimerThread.run(Timer.java:462)
Caused by: javax.mail.AuthenticationFailedException: 535 5.7.8 Error: authentication failed: generic failure

 at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:809)
 at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:752)
 at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:669)
 at javax.mail.Service.connect(Service.java:295)
 at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:389)
 ... 9 more

Open in new window



here is the properties file we have for email , please suggest whats wrong and how do i get this sorted ..

also i suspect since its talking about authentication, do i need to allow something on postfix , main.cf ?? at the bottom i have put the main.cf tooo ..



<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

<!--  <context:component-scan
                base-package="com.livex.mail.util" />
-->
        <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
                <property name="host"     value="localhost" />
                <property name="port"     value="25" />
                <property name="username" value="" />
                <property name="password" value="" />


                <property name="javaMailProperties">
                        <props>
                <prop key="mail.smtp.auth">false</prop>
                <prop key="mail.smtp.starttls.enable">false</prop>
                </props>
                </property>

        </bean>
        <bean id="mailUtil" class="com.livex.mail.util.MailUtil" scope="prototype">
                <property name="mailSender" ref="mailSender" />
        </bean>

</beans>

Open in new window

0
Clement P
Asked:
Clement P
  • 5
2 Solutions
 
g3nu1n3Commented:
I am definitely not an expert but thought to get the ball rolling for you in terms of something you will want to look into. Basically it looks like the connection is taking place because your error message does not say connection refused or not able to connect. However in viewing this:
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
                <property name="host"     value="localhost" />
                <property name="port"     value="25" />
                <property name="username" value="" />
                <property name="password" value="" />

I would say that you need to provide the appropriate credentials in the username and password properties. Not sure if you are supplying those via a form if at all, but in my experience, authentication should be on and you will need to supply proper username/email and password credentials.
0
 
Clement PAuthor Commented:
Yes we are gvng the username and password.Even tried root user there and still the same.

Thanks
0
 
Clement PAuthor Commented:
Hi All, so instead of using the localhost as the mail host on java properties file, if i use an internal exchange server's IP, emails go out fine. now we have a diff issue. Emails go fine to internal emails, however to the external emails the mails end up staying in the exchange server queue. here is the smtp logs
2012-09-17 11:08:54 192.168.10.127 app-lx3.domain.com SMTPSVC1 EXCHSRV1 192.168.10.2 0 EHLO - +app-lx3.domain.com 250 0 212 23 0 SMTP - - - -
2012-09-17 11:08:54 192.168.10.127 app-lx3.domain.com SMTPSVC1 EXCHSRV1 192.168.10.2 0 MAIL - +FROM:<webtest@domain.co.uk> 250 0 45 32 0 SMTP - - - -
2012-09-17 11:08:54 192.168.10.127 app-lx3.domain.com SMTPSVC1 EXCHSRV1 192.168.10.2 0 RCPT - +TO:<oe15509@domain.co.uk> 250 0 33 30 0 SMTP - - - -
2012-09-17 11:08:54 192.168.10.127 app-lx3.domain.com SMTPSVC1 EXCHSRV1 192.168.10.2 0 RCPT - +TO:<arun.sharma@anydomain.com> 250 0 42 39 0 SMTP - - - -
2012-09-17 11:08:54 192.168.10.127 app-lx3.domain.com SMTPSVC1 EXCHSRV1 192.168.10.2 0 RCPT - +TO:<webtest@domain.co.uk> 250 0 33 30 0 SMTP - - - -
2012-09-17 11:08:54 192.168.10.127 app-lx3.domain.com SMTPSVC1 EXCHSRV1 192.168.10.2 0 RCPT - +TO:<Deepak.rohilla@anydomain.com> 250 0 45 42 0 SMTP - - - -
2012-09-17 11:08:54 192.168.10.127 app-lx3.domain.com SMTPSVC1 EXCHSRV1 192.168.10.2 0 DATA - +<21911485.8.1347880037237.JavaMail.lxweb@app-lx3.domain.com> 250 0 144 32548 31 SMTP - - - -
2012-09-17 11:08:54 192.168.10.127 app-lx3.domain.com SMTPSVC1 EXCHSRV1 192.168.10.2 0 QUIT - app-lx3.domain.com 240 31 59 4 0 SMTP - - - -
2012-09-17 11:08:54 216.82.241.115 OutboundConnectionResponse SMTPSVC1 EXCHSRV1 - 25 - - 220+server-2.tower-52.messagelabs.com+ESMTP 0 0 43 0 94 SMTP - - - -
2012-09-17 11:08:54 216.82.241.115 OutboundConnectionCommand SMTPSVC1 EXCHSRV1 - 25 EHLO - domain.com 0 0 4 0 94 SMTP - - - -
2012-09-17 11:08:54 216.82.241.115 OutboundConnectionResponse SMTPSVC1 EXCHSRV1 - 25 - - 250-server-2.tower-52.messagelabs.com 0 0 37 0 188 SMTP - - - -
2012-09-17 11:08:54 216.82.241.115 OutboundConnectionCommand SMTPSVC1 EXCHSRV1 - 25 MAIL - FROM:<Webtest@domain.com> 0 0 4 0 188 SMTP - - - -
2012-09-17 11:08:54 216.82.241.115 OutboundConnectionResponse SMTPSVC1 EXCHSRV1 - 25 - - 250+OK 0 0 6 0 281 SMTP - - - -
2012-09-17 11:08:54 216.82.241.115 OutboundConnectionCommand SMTPSVC1 EXCHSRV1 - 25 RCPT - TO:<arun.sharma@anydomain.com> 0 0 4 0 281 SMTP - - - -
2012-09-17 11:08:54 216.82.241.115 OutboundConnectionCommand SMTPSVC1 EXCHSRV1 - 25 RCPT - TO:<deepak.rohilla@anydomain.com> 0 0 4 0 281 SMTP - - - -
2012-09-17 11:08:54 216.82.241.115 OutboundConnectionResponse SMTPSVC1 EXCHSRV1 - 25 - - 250+OK 0 0 6 0 360 SMTP - - - -
2012-09-17 11:08:54 216.82.241.115 OutboundConnectionCommand SMTPSVC1 EXCHSRV1 - 25 DATA - - 0 0 4 0 360 SMTP - - - -
2012-09-17 11:08:54 192.168.10.127 app-lx3.domain.com SMTPSVC1 EXCHSRV1 192.168.10.2 0 EHLO - +app-lx3.domain.com 250 0 212 23 0 SMTP - - - -
2012-09-17 11:08:54 192.168.10.127 app-lx3.domain.com SMTPSVC1 EXCHSRV1 192.168.10.2 0 MAIL - +FROM:<webtest@domain.co.uk> 250 0 45 32 0 SMTP - - - -
2012-09-17 11:08:54 192.168.10.127 app-lx3.domain.com SMTPSVC1 EXCHSRV1 192.168.10.2 0 RCPT - +TO:<info.grandscrusencave35457@domain.co.uk> 250 0 52 49 0 SMTP - - - -
2012-09-17 11:08:54 192.168.10.127 app-lx3.domain.com SMTPSVC1 EXCHSRV1 192.168.10.2 0 RCPT - +TO:<arun.sharma@anydomain.com> 250 0 42 39 0 SMTP - - - -
2012-09-17 11:08:54 192.168.10.127 app-lx3.domain.com SMTPSVC1 EXCHSRV1 192.168.10.2 0 RCPT - +TO:<webtest@domain.co.uk> 250 0 33 30 0 SMTP - - - -
2012-09-17 11:08:54 192.168.10.127 app-lx3.domain.com SMTPSVC1 EXCHSRV1 192.168.10.2 0 RCPT - +TO:<Deepak.rohilla@anydomain.com> 250 0 45 42 0 SMTP - - - -
2012-09-17 11:08:54 192.168.10.127 app-lx3.domain.com SMTPSVC1 EXCHSRV1 192.168.10.2 0 DATA - +<29317994.11.1347880037784.JavaMail.lxweb@app-lx3.domain.com> 250 0 145 32800 31 SMTP - - - -
2012-09-17 11:08:54 192.168.10.127 app-lx3.domain.com SMTPSVC1 EXCHSRV1 192.168.10.2 0 QUIT - app-lx3.domain.com 240 31 59 4 0 SMTP - - - -
2012-09-17 11:08:54 216.82.241.115 OutboundConnectionResponse SMTPSVC1 EXCHSRV1 - 25 - - 354+go+ahead 0 0 12 0 438 SMTP - - - -

I am changing the zone for this message as now its now an exchange server issue. thanks for your help guys
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
Sudeep SharmaTechnical DesignerCommented:
which Exchange server are you using, Exchange 2007 or Exchange 2010?
0
 
Clement PAuthor Commented:
Exchange server 2003
0
 
Clement PAuthor Commented:
thanks
0
 
Clement PAuthor Commented:
Issue was resolved with help from our developers.
0

Featured Post

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now