0

I use the Java based CMS dotCMS and I want to use google as the smtp server. I used the config as described in the dotCMS docs: http://dotcms.com/docs/latest/mail-configuration.

My config looks like this:

    <Resource
            name="mail/MailSession"
            auth="Container"
            type="javax.mail.Session"
            mail.debug="true"
            mail.transport.protocol="smtp"
            mail.smtp.host="smtp.gmail.com"
            mail.smtp.auth="true"
            mail.smtp.port="465"
            mail.smtp.starttls.enable="true"
            mail.smtp.user="[my username]"
            mail.password="[my pwd]"
            username="[my username]"
            password="[my pwd]"
            mail.smtp.socketFactory.class="javax.net.ssl.SSLSocketFactory"
     />

When I call the $mailer.sendEmail method I get an error back:

"Unable to Send Message: 530 5.7.0 Must issue a STARTTLS command first. c7sm25357283wjb.19 - gsmtp".

I also tried port 587, but that did not help either.

Any idea what I am doing wrong? I'm using dotcms 2.5.6. running on debian 7.8 (wheezy)

Koen Peters
  • 12,798
  • 6
  • 36
  • 59

2 Answers2

2

You shouldn't need the socketFactory setting.

You also shouldn't need the port setting.

Try setting mail.smtp.ssl.enable=true. If that doesn't work, try setting mail.transport.protocol=smtps and change all the mail.smtp.* settings to mail.smtps.*.

The Gmail entry in the JavaMail FAQ might be useful.

If none of that works, post the JavaMail debug output.

Bill Shannon
  • 29,579
  • 6
  • 38
  • 40
1

Do you have 2 factor authentication set up in google? I think this might prevent the authentication from happening.

wezell
  • 573
  • 3
  • 7