Link to home
Start Free TrialLog in
Avatar of Clement P
Clement PFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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

SOLUTION
Avatar of g3nu1n3
g3nu1n3
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Clement P

ASKER

Yes we are gvng the username and password.Even tried root user there and still the same.

Thanks
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
Avatar of Sudeep Sharma
which Exchange server are you using, Exchange 2007 or Exchange 2010?
Exchange server 2003
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Issue was resolved with help from our developers.