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

msftarav
Champ in-the-making
Champ in-the-making
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.

Thanks for the reply again!! I figured that using "smtp.gmail.com" doesn't work, so I used the IP address of that and i think it works, because it throws me an error saying it Failed to send e-mail to *******@*****.com

I checked the  custom-email-server.properties and it only had Email Inbound server and Email server properties. Do I have to modify the E-mail server properties in that?

email.server.enabled=true
email.server.port=465
email.server.domain= ( I am not sure of what to enter for this one ) Do u have an idea?

Thanks

l33m4n
Champ in-the-making
Champ in-the-making
Hi,

I'm just installing 4 and I have managed to get a test email to send from Gmail when the subsystem initializes following the instructions here

http://wiki.alfresco.com/wiki/Outbound_E-mail_Configuration

However, when I send an external invitation the message says that the email was successfully sent but the invitation doesn't arrive.

I can see the test email in my Gmail sent items but the missing invitations aren't there or in the spam / trash folders.

Has anyone else managed to solve this problem?

Thanks!

l33m4n
Champ in-the-making
Champ in-the-making
I've solved the problem. It was actually very simple but I haven't seen this documented anywhere..

In the default installation version of alfresco-global.properties there is a line that reads:-

### E-mail site invitation setting ###
notification.email.siteinvite=false

Just change it to read:-

### E-mail site invitation setting ###
notification.email.siteinvite=true

msftarav
Champ in-the-making
Champ in-the-making
I've solved the problem. It was actually very simple but I haven't seen this documented anywhere..

In the default installation version of alfresco-global.properties there is a line that reads:-

### E-mail site invitation setting ###
notification.email.siteinvite=false

Just change it to read:-

### E-mail site invitation setting ###
notification.email.siteinvite=true


Hello l334n,

I have alfresco 3.2 and I have been trying to make e-mail feature work with it. I have changed alfresco-global.properties values as described in alfresco wiki page on outbound e-mail configuration. I have added the notification.email.siteinvite=true, i have also included the test message codes in alfresco-global.properties, but nothing seems to work. Can you think of anything else that might be the problem?

Thank you

l33m4n
Champ in-the-making
Champ in-the-making
Have you followed all of the steps on the link I posted above?

Now, we need to enable SMTPS by overriding the mailService bean. Create and edit <TOMCAT_HOME>/classes/alfresco/extension/custom-email-context.xml and paste in the following:

<?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>

msftarav
Champ in-the-making
Champ in-the-making
Have you followed all of the steps on the link I posted above?

Now, we need to enable SMTPS by overriding the mailService bean. Create and edit <TOMCAT_HOME>/classes/alfresco/extension/custom-email-context.xml and paste in the following:

<?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>



I did except for the "Email Action Executor"

Alfresco uses the action service to send email.

MailActionExecuter The following properties can be set.

    PARAM_NAME = "mail"
    PARAM_TO = "to"
    PARAM_TO_MANY = "to_many"
    PARAM_SUBJECT = "subject"
    PARAM_TEXT = "text"
    PARAM_FROM = "from"
    PARAM_TEMPLATE = "template";
    FROM_ADDRESS = "alfresco@alfresco.org";


I am not sure of how to do this one. If we have to set this manually, can you let me know on how to do this? This is the only step i missed.

Thanks

kjcsb
Champ in-the-making
Champ in-the-making
Alfresco 4.0c
Ubuntu
I am experiencing an issue when trying to use Gmail SMTP

vi
mail.host=smtp.gmail.com
mail.port=465
mail.protocol=smtps
mail.username=test@gmail.com
mail.password=password
mail.encoding=UTF-8
mail.smtps.auth=true
mail.smtps.starttls.enable=true
mail.from.default=test@gmail.com

03:54:14,275 ERROR [org.alfresco.repo.action.executer.MailActionExecuter] Failed to send email to test@test.domain.com
org.springframework.mail.MailSendException: Failed messages: javax.mail.MessagingException: IOException while sending message;
  nested exception is:
        java.io.UnsupportedEncodingException: UTF-8

I have checked and there are no extra spaces of characters in the line mail.encoding=UTF-8

Any suggestions appreciated

mrogers
Star Contributor
Star Contributor
There's no need to touch that setting for gmail.   The default value works.

l33m4n
Champ in-the-making
Champ in-the-making
msftarav,

I did except for the "Email Action Executor"

Alfresco uses the action service to send email.

MailActionExecuter The following properties can be set.

PARAM_NAME = "mail"
PARAM_TO = "to"
PARAM_TO_MANY = "to_many"
PARAM_SUBJECT = "subject"
PARAM_TEXT = "text"
PARAM_FROM = "from"
PARAM_TEMPLATE = "template";
FROM_ADDRESS = "alfresco@alfresco.org";


I am not sure of how to do this one. If we have to set this manually, can you let me know on how to do this? This is the only step i missed.

I didn't configure this bit (I'm not sure you have to). I'm sorry I can't offer any more advice.

l33m4n
Champ in-the-making
Champ in-the-making
I thought it might help others if I also report that Gmail keeps locking my account when testing this with Gmail and I have to unlock it using Captcha.