Nuxeo Connexion to SMTP Google Mail - GMail

Hi all,

This post is a copy/paste of a community forum question I posted as I don't know the better place to ask. Sorry for double posting if this is raising problems to anyone.

I juste gave a new try to Nuxeo 5.5 using a fresh install on ubuntu server LTS and I'm not succeeding in configurating mail service (we use GoogleMail). I have seen a lot of related post and according to them my configuration seems to be correct (at least to me…):

nuxeo.notification.eMailSubjectPrefix="[Nuxeo]"
mail.smtp.host=smtp.gmail.com
mail.smtp.port=587
mail.smtp.usetls=true
mail.smtp.auth=true
mail.smtp.username=myuser@mycompany.com
mail.smtp.password=myuserpassword
mail.from=myuser@mycompany.com
mailservice.user=myuser@mycompany.com
mailservice.password=myuserpassword
mail.store.protocol=imap
mail.transport.protocol=smtp
mail.user=myuser@mycompany.com
mail.debug=true

Note: I have used this configuration on a mail client so I'm sure the credentials and settings are correct.

When I try to send an email notification (I use the email feature on one document to test it) I got the following warning in the /var/log/nuxeo/console.log (Is there somewhere else to check for logs (I have nothing in mail.log, syslog or any other nuxeo.log) (I have activated the mail.debug = true option)

2011-12-20 11:49:54,252 WARN [org.nuxeo.ecm.platform.ec.notification.NotificationEventLis tener] Failed to send notification email to 'recipient@company.com': javax.mail.AuthenticationFailedException: null

It seems to be a warning only but the e mail is never delivered.

Could this be an email settings problem or a java problem or whatsoever ? I really don't know how to troubleshoot this

Many thanks in advance

Snarf

1 votes

4 answers

3746 views

ANSWER



In my case that works I have this configuration:

mail.from=no-reply@nuxeo.com
#mail.smtp.usetls=false
mail.smtp.usetls=true
#mail.smtp.host=localhost
mail.smtp.host=smtp.gmail.com
#mail.smtp.port=25
mail.smtp.port=587
#mail.smtp.username=anonymous
mail.smtp.username=bjalon@nuxeo.com
#mail.smtp.auth=false
mail.smtp.auth=true
#mail.smtp.password=password
mail.smtp.password= ... 
#mail.debug=false
mail.debug=true

I test it on 5.4.2, 5.5 and it works.

About the password, I had a problem that must be fixed since 5.4.3: https://jira.nuxeo.com/browse/NXBT-311

But maybe you have other special character not well escaped. If this is the case you can create a ticket into our JIRA.

[Edit] bug is still here so that may be your problem… So to escape & you must replace it into your nuxeo.conf by that

&

You can follow the bug here: https://jira.nuxeo.com/browse/NXP-5470

Once, I had a trouble like you since I change my password.

I see here to use this url:

https://www.google.com/accounts/DisplayUnlockCaptcha

Maybe it will work for you.


If you continue to have trouble maybe you can look into your logs sometimes messages are explicit. I let you looking this answer:

http://answers.nuxeo.com/questions/950/mail-debug-option

logs are into $NUXEO/log/server.log

For developers, I just want to explain that we are using the standard java mail library and you can look into our code that mail sends is made like that:

InitialContext ic = new InitialContext();
javax.mail.Session session = getSession();
(Session) ic.lookup("java:comp/env/Mail");

MimeMessage msg = new MimeMessage(session);

msg.setFrom(new InternetAddress(session.getProperty("mail.from")));
Object to = "bjalon@nuxeo.com";
msg.setRecipients(javax.mail.Message.RecipientType.TO,
        InternetAddress.parse((String) to, false));

... Build your message ...
javax.mail.Transport.send(msg);
1 votes



I had a trouble like you since I change my password.

I see here to use this url:

https://www.google.com/accounts/DisplayUnlockCaptcha

Maybe it will work for you.

0 votes



I tried all the ways mentioned above but still cannot make it work to send out email notification.

Is there any configuration that can work well with Gmail in general and Google Apps mail in particular? If any, what are the straight parameter for it?

Can it be done straiforwardly only with configuration in Admin Center without anything to be done with config files?

I think alot of people will face this difficulty. I wish that there's a clear solution for this.

Thank you.

11/29/2013


I finally succeed in making it work if I use a credential like user@gmail.com. Using user@mycompany.com (with mycompany using gmail server for email service) it failed each time.

bjalon: Do you use bjalon@nuxeo.com as user to authenticate or is it only for the example ? as it seems for me to be the main root cause. it seems I will have to create a fake googlemail account just for nuxeo server to authenticate in my case.

Is there some known issues related to entreprise googlemail service against classical gmail account ?

Thank you

Snarf

0 votes



Yes I test with my company mail account.

Did you try to change temporally your password for something more simple?

Do you have error in your logs?

You have to understand that behind the nuxeo.conf stuff in fact we configure the java mail descriptor. Look into the template directory the nuxeo.xml file. You will find our nuxeo.conf parameters. This nuxeo.xml file is our resources definition (datasources definition, and mail.

The Nuxeo launcher just copy this file with the nuxeo.conf parameter where tomcat waiting for this configuration file. This problem is not at all specific to Nuxeo. You can try to create a small we app that send an email (you must have something like in a tutorial with the generated mail). Copy the resources definition contained into your nuxeo.xml file and you normally will have the same trouble.

Tell us if you find something in your server.log (WARN, ERROR)

12/21/2011

Yes I did that and the password can't be more simple …

In my log I just have the one described in my first post: 2011-12-20 11:49:54,252 WARN [org.nuxeo.ecm.platform.ec.notification.NotificationEventLis tener] Failed to send notification email to 'recipient@company.com': javax.mail.AuthenticationFailedException: null

I opened a new thread because I'm not able to activate the debug option (it is but I have no additionnal SMTP debug message in my log I don't why) so I can't provide more information at the moment.

This is the only WARNing I can see (no error nor additinnal log to share)

Concerning the mail.xml file, I have found it on the whole partition with no luck. I have find a nuxeo.xml (with a mail seection) which seems to use the nuxeo.conf parameters to populate some java parameters but I can't find the mail.xml you mentionned. (Sorry for so beginners question but I feel at home with database and linux server but Java and Tomcat is for me totally unknown).

Thanks for your continuous help.

Snarf

12/21/2011


Many thanks for answering.

Unfortunately I have no “&” character in the username I supplied. [edit] nor password [/edit]

I have a dash (-) in the e mail of the nuxeo user I want to send the email but I don't think this could be an issue.

I have a moment ago seen some post related to “external mail user” so I must say that the username used for authenticate against gmail is not a user declared in nuxeo (but the e mail recipient is of course a nuxeo user). Could this be a cause ?

At last, can anyone help me to understand the ajax fault and how to investigate that ?

Thank you

Snarf

0 votes



No there is no link between the Nuxeo users and the external mail user.
12/20/2011

for ajax fault create another question…
12/20/2011