cancel
Showing results for 
Search instead for 
Did you mean: 

Email - Alfresco with Gmail SMTP

heislord5
Champ in-the-making
Champ in-the-making
Hi,

I have been trying tirelessly to get this working.  I've tried dozens of different configurations in the core-services-content.xml file.  Does ANYONE have email working with Gmail SMTP in Alfresco 3!  Not 2.1.

Anyone?  I think it just doesn't work.  I've tried a number of configurations that have worked for others in earlier versions, but no dice for me (I am attempting on 3c).

Here are the things I've found out.  It appears that Gmail uses 465 for SSL communication and 587 for non-ssl.  Also, you have to starttls before you can connect.

The parameters vary from person to person and none of them work for me.  I'm going to list them below.  Some will have (s) on there…that means the "s" is sometimes not there depending on who I was getting the information from.  Since 465 is the SSL port, that is when one might expect to have the "s" on the parameter, but not even that was consistent.  Some people showed it with and some without the "s".  For simplicity I hard coded the values rather than using the properties file.


  <property name="host">
    <value>smtp.gmail.com</value>
  </property>
  <property name="port">
    <value>465</value>
  </property>                                         
  <property name="protocol">                           
    <value>smtps</value>
  </property>
  <property name="username">
    <value>userName@gmail.com</value>
  </property>
  <property name="password">
    <value>UserPassword</value>
  </property>
  <property name="defaultEncoding">
    <value>UTF-8</value>
  </property>

  <property name="javaMailProperties">
    <props>
      <prop key="mail.smtps.auth">true</prop>
      <prop key="mail.smtp.socketFactory.port">465</prop>
      <prop key="mail.smtp.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>
      <prop key="mail.smtp.socketFactory.fallback">false</prop>
      <prop key="mail.smtp.timeout">25000</prop>
      <prop key="mail.smtps.starttls.enable">true</prop>
    </props>
  </property>

I tried bunches of variations with the 587 port as well without the s's and with the s's and mixed bag.

Does anyone have this working.  It would be super awesome if someone actually got it working.
31 REPLIES 31

bnice
Champ in-the-making
Champ in-the-making
Hi spilai,

I'll check your configuration for my needs and let you know if it works for me.
Thanks for your reply.

bnice
Champ in-the-making
Champ in-the-making
Just tested these settings - I get no error with that, but seems like Alfresco is not sending invitations.
Where can I see some more debug on that?

mac_src
Champ in-the-making
Champ in-the-making
Hi,
I am working with Alresco 4.0 and was trying to setup the e-mail. Please follow the most authentic page(https://forums.alfresco.com/en/viewtopic.php?f=8&t=27566) for it first and if you still face issue then you can try with the following required files and modifications.
Modified files are:
1.C:\Alfresco\tomcat\shared\classes\alfresco-global.properties

#######################################
####### Sample Gmail settings  ########
#######################################
### E-mail site invitation setting ###
#notification.email.siteinvite=false ### Original
notification.email.siteinvite=true

#Mail Setup
mail.host=smtp.gmail.com
mail.port=465
mail.protocol=smtps
mail.username=xxxxxx@gmail.com
mail.password=xxxxxxxxxx   #please note that you need to get site specific password from your gmail account
mail.encoding=UTF-8

#### New Properties ####
mail.smtps.starttls.enable=true
mail.smtps.auth=true

##### Test SMTP setup
mail.testmessage.send=true
mail.testmessage.to=xxxxxx@live.com
mail.testmessage.subject=Outbound SMTP
mail.testmessage.text=The Outbound SMTP email subsystem is working.


2.C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco\subsystems\email\OutboundSMTP\outboundSMTP.properties (Use the same default settings)

<bean id="mailService" class="org.springframework.mail.javamail.JavaMailSenderImpl">
        <property name="host">
            <value>${mail.host}</value>
        </property>
        <property name="port">
            <value>${mail.port}</value>
        </property>
      <property name="protocol">
         <value>${mail.protocol}</value>
      </property>

        <property name="username">
            <value>${mail.username}</value>
        </property>
        <property name="password">
            <value>${mail.password}</value>
        </property>
        <property name="defaultEncoding">
            <value>${mail.encoding}</value>
        </property>
      <property name="javaMailProperties">
        <props>
            <prop key="mail.smtp.auth">${mail.smtp.auth}</prop>
            <prop key="mail.smtp.debug">${mail.smtp.debug}</prop>
            <prop key="mail.smtp.timeout">${mail.smtp.timeout}</prop>
            <prop key="mail.smtp.starttls.enable">${mail.smtp.starttls.enable}</prop>
           
            <prop key="mail.smtps.auth">${mail.smtps.auth}</prop>
            <prop key="mail.smtps.starttls.enable">${mail.smtps.starttls.enable}</prop>
        </props>
    </property>

    </bean>
3.C:\Alfresco\tomcat\shared\classes\alfresco\extension\custom-email-context.properties
( ##You need to create and edit this file)

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
<!–                        –>
<!– MAIL SERVICE           –>
<!–                        –>

<bean id="mailService" class="org.springframework.mail.javamail.JavaMailSenderImpl">
    <property name="host">
        <value>${mail.host}</value>
    </property>
    <property name="port">
        <value>${mail.port}</value>
    </property>
    <property name="protocol">
        <value>${mail.protocol}</value>
    </property>
    <property name="username">
        <value>${mail.username}</value>
    </property>
    <property name="password">
        <value>${mail.password}</value>
    </property>
    <property name="defaultEncoding">
        <value>${mail.encoding}</value>
    </property>
    <property name="javaMailProperties">
        <props>
            <prop key="mail.smtps.auth">${mail.smtps.auth}</prop>
            <prop key="mail.smtps.starttls.enable">${mail.smtps.starttls.enable}</prop>
        </props>
    </property>
</bean>
</beans>

bnice
Champ in-the-making
Champ in-the-making
So there's release 4.0? Ooops, last time I checked updates, it was 3.4d…
Thanks for replying on that issue, most probably it' would cause troubles again when updating…

wabson
Star Contributor
Star Contributor
See this post for information on 4.0, where the XML config should not be needed.

https://forums.alfresco.com/en/viewtopic.php?f=9&t=36053&p=121730#p121434

Cheers,
Will

msftarav
Champ in-the-making
Champ in-the-making
Hello mac_src

I am using Alfresco 3.2 and I tried to do all what you have mentioned, but i still couldn't succeed. The error message that i got is:

Caused by: java.net.UnKnownHostException: smtp.gmail.com
                 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
                 at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
                 at java.net.Socket.connect(Socket.java:529)
                 …….
               . …….

can someone guide me through this?

Any help will be greatly appreciated!!

Thanks!!

msftarav
Champ in-the-making
Champ in-the-making
Hello ppl,

I am using Alfresco Share 3.2 and I am trying to activate the e-mail notification. I have tried all the solutions mentioned in this thread and still couldn't get it done.

I couldn't find the E-mail folder inside subsystem when I tried doing what mac_src said.

I also tried to do what spillai has mentioned in the thread and that too dint fix the issue.

Thanks

mrogers
Star Contributor
Star Contributor
Your first error seems to be Unknown host exception for "smtp.gmail.com".

So can you ping smtp.gmail.com?    What's wrong with your infrastructure, have you got a firewall in the way?

msftarav
Champ in-the-making
Champ in-the-making
Your first error seems to be Unknown host exception for "smtp.gmail.com".

So can you ping smtp.gmail.com?    What's wrong with your infrastructure, have you got a firewall in the way?


Thank you for the reply mrogers!! I am able to reach smtp.gmail.com but it has some loss!! We have alfresco share in a virtual machine( ubuntu) inside windows 2008 server. I have opened the port in both windows and ubuntu environment. I actually had tried using yahoo business mail server too. That too dint seem to work.

As per the thread I tried all of them, but what I found odd was that i couldn't find the E-mail folder inside the Subsystems folder!! Does this mean something to you?

  var\lib\tomcat6\webapps\alfresco\WEB-INF\classes\alfresco\subsystems\email\OutboundSMTP\outboundSMTP.properties
The highlighted part was not there!!

mrogers
Star Contributor
Star Contributor
Yes that is a concern.   However from memory the subsystem framework was new in 3.2 and I can't remember in which release SMTP was refactored to use subsystems.   Its possible your version has "old style" configuration which would be  custom-email-server.properties.

You should never touch anything below WEB-INF (since its Alfresco's private implementation detail,) you can look but you shouln't change stuff because it will get lost on upgrade..

The first thing to check is that you can connect to your email server (gmail?) from the box that you want to send email from.  Use whatever email client you have available.   That will validate all the paths and settings needed.      Then you can worry about alfresco's configuration.