sending mail not working (xnat 1.6, but not working before either)

1,306 views
Skip to first unread message

Torsten Rohlfing

unread,
Sep 11, 2012, 6:14:36 PM9/11/12
to xnat_di...@googlegroups.com
And me again with another problem :)

So another thing that isn't working for me is any form of mails being sent by XNAT (currently 1.6, but didn't work with 1.5.4 either).

Here's where I have gotten so far:

- No error in Web interface when I send mails manually
- Mail host is localhost running sendmail
- Using xnat user/pw in build.properties - logging in as xnat and using "alpine" I can send emails with no problem

Log files say the following:

/var/log/maillog:

Sep 11 15:05:42 neuro sendmail[27525]: q8BM5gS2027525: localhost.localdomain [127.0.0.1] did not issue MAIL/EXPN/VRFY/ETRN during connection to MTA


xdat.log:

2012-09-11 15:05:42,311 [http-bio-8080-exec-17] ERROR org.nrg.xdat.turbine.modules.actions.EmailAction - Invokation of public void org.nrg.xdat.turbine.modules.actions.EmailAction.doPerform(org.apache.turbine.util.RunData,org.apache.velocity.context.Context) throws java.lang.Exception
org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException: 535 5.7.0 authentication failed

        at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:392)
        at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:306)
        at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:296)
        at org.nrg.mail.services.impl.SpringBasedMailServiceImpl.sendMessage(SpringBasedMailServiceImpl.java:44)
        at org.nrg.mail.services.impl.AbstractMailServiceImpl.sendHtmlMessage(AbstractMailServiceImpl.java:253)
        at org.nrg.mail.services.impl.AbstractMailServiceImpl.sendHtmlMessage(AbstractMailServiceImpl.java:289)
        at org.nrg.mail.services.impl.AbstractMailServiceImpl.sendHtmlMessage(AbstractMailServiceImpl.java:358)
[and so forth]

After doing some googling, I tried this with and without saslauthd running, but that made no difference whatsoever.

Would be great if anyone had some ideas where else to look.

Thanks!
  Torsten

Herrick, Rick

unread,
Sep 12, 2012, 5:17:57 AM9/12/12
to xnat_di...@googlegroups.com
The good news is that 1.6 should give you a lot more options for configuring the connection to your mail host. The bad news is that I have absolutely no idea what that error message means :)

So partly it looks like there's authentication required. Can you try to modify your sendmail configuration to turn off authentication, at least for a bit so you can see if plain SMTP transaction works properly? If you can take sendmail down to as vanilla as possible and validate email function there, then we can tell if the issue is XNAT or sendmail.

Another option is to configure XNAT to use gmail, again at least just to validate function. There's a configuration file mail-services-config.smtps.sample.xml under plugin-resources/conf (I think it actually gets copied into the web app as well) that you can copy over the default mail-services-config.xml. If you configure the proper values in services.properties in the same folder, you should be able to connect with a gmail account.

Now getting either one of those to work doesn't solve your sendmail problem, but it would isolate the problem to either sendmail configuration or XNAT and let you focus on fixing the actual problem.

Rick Herrick

Sr. Programmer/Analyst

Neuroinformatics Research Group

Washington University School of Medicine

(314) 827-4250


From: xnat_di...@googlegroups.com [xnat_di...@googlegroups.com] on behalf of Torsten Rohlfing [torsten...@gmail.com]
Sent: Tuesday, September 11, 2012 5:14 PM
To: xnat_di...@googlegroups.com
Subject: [XNAT Discussion] sending mail not working (xnat 1.6, but not working before either)

--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To view this discussion on the web visit https://groups.google.com/d/msg/xnat_discussion/-/xRaDVgUU-VUJ.
To post to this group, send email to xnat_di...@googlegroups.com.
To unsubscribe from this group, send email to xnat_discussi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/xnat_discussion?hl=en.



The material in this message is private and may contain Protected Healthcare Information (PHI). If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.

Torsten Rohlfing

unread,
Sep 12, 2012, 5:03:46 PM9/12/12
to xnat_di...@googlegroups.com
Okay, I fixed it - turns out, the plugin-resources/conf/mail-services-config.xml file that is shipping with XNAT isn't working.

But one thing at a time -

- Google mail worked with the provided config file.

- My Sendmail is already configured not to expect authentication (maybe that's the root of the problem?)

So then I looked at the mail config file and edited it to the following:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

    <!-- Load the NRG Mail basic application context. -->
    <import resource="classpath:/META-INF/configuration/nrg-mail-context.xml" />

    <!-- Bootstrap the Spring mail sender. -->
    <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"
          p:host="${mailserver.host}"
          p:port="${mailserver.port}"
          p:protocol="${mailserver.protocol}" />

</beans>

Basically, I removed the user name and password properties of the <bean> item, but added protocol instead.

Now mailing works. :)

Thanks for the pointers Rick!

fahad...@manchester.ac.uk

unread,
Sep 24, 2013, 7:47:13 AM9/24/13
to xnat_di...@googlegroups.com
Hi

I am getting the same error, is there any update on possible solution?

Herrick, Rick

unread,
Sep 24, 2013, 6:35:03 PM9/24/13
to xnat_di...@googlegroups.com

This is a really difficult error for us to be able to say much about, since it all really depends on your SMTP server configuration. What XNAT provides out of the box should work in 99% of SMTP servers that don’t require authentication. I’ve seen some cases where people have used the default mail-services-config.xml configuration, then put values into build.properties (which get carried over to services.properties in your deployed web application) that cause it to break.

 

For example, in one case, someone had an SMTP server that had required authentication and had these values set in the services.properties:

 

mailserver.host=mail.outserver.place.org

mailserver.port=25

mailserver.username=foo

mailserver.password=bar

mailserver.protocol=smtp

 

Mail sending started to fail. The reason was that the IT department had switched off authentication and specifying auth credentials actually broke the SMTP handshake. So we changed those values like this:

 

mailserver.username=

mailserver.password=

 

In other cases, e.g. when you’re using Gmail’s SMTP servers, the configuration has to be very precise. That’s how plugin-resources\conf\mail-services-config.smtps.sample.xml is configured. The values have to be exact for that to work:

 

mailserver.host=smtp.gmail.com

mailserver.port=465

mailserver.username=y...@gmail.com

mailserver.password=bar

mailserver.protocol=smtps

 

But it’s important to note that smtps is not really a protocol in spite of the naming. It’s really just SMTP over TLS/SSL and the port is completely dependent on the configuration of the mail server (although 465 is often used because it was originally the port specified for SMTPS, but now is registered for something else).

 

The point I’m trying to make in a very long-winded (long-typed?) way is highly dependent on your SMTP server configuration. The solutions for these issues will be specific to that configuration. You can try posting your mail-services-config.xml and services.properties (removing any passwords or other sensitive info) and I can have a look at it to see if anything stands out, but if there’s an issue on the server side, that would be something for your server admin or IT staff to figure out.

 

Rick Herrick

Sr. Programmer/Analyst

Neuroinformatics Research Group

Washington University School of Medicine

(314) 827-4250

 

--

You received this message because you are subscribed to the Google Groups "xnat_discussion" group.

To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.


To post to this group, send email to xnat_di...@googlegroups.com.

Fahad Anwar

unread,
Sep 25, 2013, 6:50:43 AM9/25/13
to xnat_di...@googlegroups.com

I got your point; however since the same account/mail server is working fine with another xnat server (1.4 VM) that means most like the issue is on xnat configuration files. Please find attached the services.properties and your mail-services-config.xml file.

 

Thanks for all your help

 

With regards

 

Fahad

services.properties
mail-services-config.xml

Herrick, Rick

unread,
Sep 25, 2013, 10:00:28 AM9/25/13
to xnat_di...@googlegroups.com
The mail-services-config.xml was blocked by our mail server. Can you rename it with a .txt extension and resend?


Rick Herrick

Sr. Programmer/Analyst

Neuroinformatics Research Group

Washington University School of Medicine

(314) 827-4250


From: xnat_di...@googlegroups.com [xnat_di...@googlegroups.com] on behalf of Fahad Anwar [Fahad...@manchester.ac.uk]
Sent: Wednesday, September 25, 2013 5:50 AM
To: 'xnat_di...@googlegroups.com'
Subject: RE: [XNAT Discussion] sending mail not working (xnat 1.6, but not working before either)

--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.
To post to this group, send email to xnat_di...@googlegroups.com.
Visit this group at http://groups.google.com/group/xnat_discussion.
For more options, visit https://groups.google.com/groups/opt_out.

Fahad Anwar

unread,
Sep 25, 2013, 10:05:14 AM9/25/13
to xnat_di...@googlegroups.com

Please see the attached file

 

From: xnat_di...@googlegroups.com [mailto:xnat_di...@googlegroups.com] On Behalf Of Herrick, Rick
Sent: 25 September 2013 15:00
To: xnat_di...@googlegroups.com
Subject: RE: [XNAT Discussion] sending mail not working (xnat 1.6, but not working before either)

 

The mail-services-config.xml was blocked by our mail server. Can you rename it with a .txt extension and resend?

mail-services-config.txt

Herrick, Rick

unread,
Sep 25, 2013, 10:14:44 AM9/25/13
to xnat_di...@googlegroups.com
Try deleting the p:username and p:password attributes on the mail sender element:
    <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"
          p:host="${mailserver.host}"
          p:port="${mailserver.port}" />
That's the only thing I can think of. Otherwise, that mail configuration is working for any other vanilla SMTP configuration going that I know of. The mail service in XNAT changed completely between 1.5 and 1.6, but this is a pretty basic transaction so it should work.

Most of the other possible causes are related to server configuration. For example, if you're seeing the error "No authentication mechanisms supported by both server and client" in the logs, it's likely that the SMTP server has an IP whitelist that contains the IP address of your 1.5 server but not the address of your 1.6 server. But that's the sort of thing that you'll need to follow up with your IT department to resolve.


Sent: Wednesday, September 25, 2013 9:05 AM

To: 'xnat_di...@googlegroups.com'
Subject: RE: [XNAT Discussion] sending mail not working (xnat 1.6, but not working before either)

Please see the attached file

 

From: xnat_di...@googlegroups.com [mailto:xnat_di...@googlegroups.com] On Behalf Of Herrick, Rick
Sent: 25 September 2013 15:00
To: xnat_di...@googlegroups.com
Subject: RE: [XNAT Discussion] sending mail not working (xnat 1.6, but not working before either)

 

The mail-services-config.xml was blocked by our mail server. Can you rename it with a .txt extension and resend?

 

Rick Herrick

Sr. Programmer/Analyst

Neuroinformatics Research Group

Washington University School of Medicine

--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.
To post to this group, send email to xnat_di...@googlegroups.com.
Visit this group at http://groups.google.com/group/xnat_discussion.
For more options, visit https://groups.google.com/groups/opt_out.

Simon Doran

unread,
Apr 7, 2014, 11:56:46 AM4/7/14
to xnat_di...@googlegroups.com
Rick,

  Fortunately Torsten's fix to change mail-services-config.xml worked for me as well. (Thanks, Torsten!) Currently, I have this modified in WEB-INF/conf, together with InstanceSettings.xml, which I needed to modify to change mail server IP address, which was given to me incorrectly when I first built this version of XNAT.

  Could you confirm the location of version I need to change in order for my changes to survive the next deletion and rebuild of the Tomcat webapps directory. I noticed that projects/XNAT/InstanceSettings.xml in the builder directory picks up the values from somewhere else.

  Thanks in advance,

Simon

Sven Prevrhal

unread,
Sep 4, 2014, 5:31:37 PM9/4/14
to xnat_di...@googlegroups.com, torsten...@gmail.com
I realize that's an old thread now but I have similar problems. I can send email directly from an ssh command line on my XNAT host with telnet. It's a Ubuntu machine with postfix, so I believe I have it configured correctly. But it doesn't work from the XNAT web interface I changed the files according to Torsten's approach, but it's still broken.  /var/log/mail.log doesn't show anything (but my telnet-sent mail) either.

Sven

George Kowalski

unread,
Apr 15, 2015, 1:55:28 PM4/15/15
to xnat_di...@googlegroups.com, torsten...@gmail.com
We are not using username / password authentication so I just had to remove these lines from the ~tomcat/webapps/xnat/WEB-INF/conf/mail-services-config.xml file : 

  p:username="${mailserver.username}" 
          p:password="${mailserver.password}" 
Reply all
Reply to author
Forward
0 new messages