Obsolete Pages{{Obsolete}}
The official documentation is at: http://docs.alfresco.com
Alfresco supports the ability to generate and send email to en external SMTP server.
For example when a new user is invited to a site an email is sent.
The email service is exposed as a spring bean called mailService which is contained within the OutboundSMTP subsystem.
This document will highlight the basic components that make this possible, give details of the types of behaviour that can be expected. This document assumes knowledge of how to extend the repository configuration.
The Alfresco repository repository can be configured to send e-mails to an external SMTP server by overriding the details found in the alfresco configuration file.
3.2+
or for older versions of Alfresco
The default SMTP configuration should look like this:
The remote SMTP server is configured through a set of properties.
Assuming that the configuration is being overridden as described in Repository Configuration, then the correct mail configuration can be placed in your alfresco-global.properties or custom-repository.properties file. You only need to give the values that differ from the main configuration file; for example, the port number will probably stay the same, so does not need to be specified in your custom configuration file.
mail.host=<the name of your SMTP host>
mail.port=<the port that your SMTP service runs on (the default is 25)>
mail.username=<the username of the account you want e-mail to be sent from>
mail.password=<the password>
The following property values are the default values that you can change.
For SMTP
For SMTPS
When the Outbound SMTP subsystem is initialized it can attempt to send an email to determine whether the server is available or not.
The mailService implementation is provided by Spring and the configuration can be customised by setting various key value pairs in javaMailProperties.
Alfresco provides configuration for the most common scenarios, however if you need a greater level of control then you can over-ride the out of the box configuration. Typically you may want to add or remove properties.
All the configuration you may need can be found at $TOMCAT_HOME/webapps/alfresco/WEB-INF/classes/alfresco/subsystems/email/OutboundSMTP/outboundSMTP.properties but do not modify this file, set up your own $TOMCAT_HOME/shared/classes/alfresco/extension/subsystems/email/OutboundSMTP/outbound or directly in the $TOMCAT_HOME/shared/classes/alfresco-global.properties file.
Gmail (gmail.com) requires the use of SMTPS
This example shows how to configure two additional java mail properties directly to: <TOMCAT_HOME>/classes/alfresco-global.properties:
# Sample Gmail settings
mail.host=smtp.gmail.com
mail.port=465
mail.username=user@gmail.com
mail.password=password
mail.protocol=smtps
mail.smtps.starttls.enable=true
mail.smtps.auth=true
Yahoo (yahoo.com) requires the use of SMTPS and mail.from.enabled=false
This example shows how to configure two additional java mail properties directly to: <TOMCAT_HOME>/classes/alfresco-global.properties:
mail.from.enabled=false
mail.from.default=user@yahoo.com
mail.host=smtp.mail.yahoo.com
mail.port=465
mail.username=user@yahoo.com
mail.password=password
mail.protocol=smtps
mail.smtps.starttls.enable=true
mail.smtps.auth=true
# Sample Zimbra settings
Not authenticated.
mail.host=zimbra.<your company>
mail.port=25
mail.username=anonymous
mail.password=
# Set this value to UTF-8 or similar for encoding of email messages as required
mail.encoding=UTF-8
# Set this value to 7bit or similar for Asian encoding of email headers as required
mail.header=
mail.from.default=<default from address>
mail.smtp.auth=false
mail.smtp.timeout=30000
You're done
The mailService implementation is provided by Spring and the configuration can be customised by setting various key value pairs in javaMailProperties.
Alfresco provides configuration for the most common scenarios, however if you need a greater level of control then you can over-ride the out of the box configuration. Typically you may want to add or remove properties.
This scenario applies to Alfresco 3.2. In later versions this will work 'out of the box' without needing custom configuration. Also please note that in 3.3 and greater the configuration of SMTP moves to a subsystem, so your over-ride will go into $TOMCAT_HOME/shared/classes/alfresco/extension/subsystems/email/OutboundSMTP/outbound.
Gmail (gmail.com) requires the use of SMTPS so you need to provide a few more configuration properties.
If you're using Gmail (gmail.com) you'll have to create a custom context file to over-ride the configuration of
'mailService' such as custom-email-context.xml in your alfresco/extension folder.
This example shows how to configure two additional java mail properties. These apply to: <TOMCAT_HOME>/classes/alfresco-global.properties (Alfresco 3.2)
# Sample Gmail settings
mail.host=smtp.gmail.com
mail.port=465
mail.protocol=smtps
mail.username=user@gmail.com
mail.password=password
# New Properties
mail.smtps.starttls.enable=true
mail.smtps.auth=true
Note that we've added these two new java mail properties to the file:
${mail.smtps.auth}
${mail.smtps.starttls.enable}
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:
<beans>
<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>
The mailService implementation is provided by Spring and the configuration can be customised by setting various key value pairs in javaMailProperties.
Alfresco provides configuration for the most common scenarios, however if you need a greater level of control then you can over-ride the out of the box configuration. Typically you may want to add or remove properties.
This scenario applies to Alfresco 3.3. In previous versions you'll had to create a custom context file to over-ride the configuration of 'mailService' such as custom-email-context.xml in your alfresco/extension folder. On 3.3 and greater version this will work 'out of the box' without needing custom configuration, you'll just have to configure with properties.
All the configuration you may need can be found at $TOMCAT_HOME/webapps/alfresco/WEB-INF/classes/alfresco/subsystems/email/OutboundSMTP/outboundSMTP.properties but do not modify this file, set up your own $TOMCAT_HOME/shared/classes/alfresco/extension/subsystems/email/OutboundSMTP/outbound or directly in the $TOMCAT_HOME/shared/classes/alfresco-global.properties file.
Gmail (gmail.com) requires the use of SMTPS so you need to provide a few more configuration properties.
This example shows how to configure two additional java mail properties directly to: <TOMCAT_HOME>/classes/alfresco-global.properties (Alfresco 3.3):
# Sample Gmail settings
mail.host=smtp.gmail.com
mail.port=465
mail.username=user@gmail.com
mail.password=password
# New Properties
mail.protocol=smtps
mail.smtps.starttls.enable=true
mail.smtps.auth=true
You're done
Alfresco uses the action service to send email.
MailActionExecuter
The following properties can be set.
To debug, you could put in alfresco log4j:
log4j.logger.org.alfresco.web.bean.TemplateMailHelperBean=debug
That will log mail emission attempts:
5:25:09,470 User:admin DEBUG [web.bean.TemplateMailHelperBean] Sending notification email to: user1@localhost
...with subject:
Test subject
...with body:
Test body
You could also do a network dump on the alfresc server to dump the stmp traffic.
This information was gathered from these places:
Email - Alfresco with Gmail SMTP: http://forums.alfresco.com/en/viewtopic.php?f=9&t=16018
failed to send email via gmail smtp: http://forums.alfresco.com/en/viewtopic.php?f=7&t=9318
Alfresco: Sending mails with Gmail: http://lorenzod8n.wordpress.com/2008/.../alfresco-sending-mails-with-gmail/
Note: This is an alternative to above configuration, we suggest not editing files inside the Alfresco WAR, instead use the extensions directory approach noted above.
Back to Server Configuration
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.