cancel
Showing results for 
Search instead for 
Did you mean: 

How to Configure the email service

ivanlee
Champ in-the-making
Champ in-the-making
I configure the file "/alfresco/repository.properties"

mail.host=smtp.gmail.com
mail.port=587
mail.username=xxx@gmail.com
mail.password=xxxxxx
mail.from.default=xxx@gmail.com

This is the error message:

User:admin ERROR [web.bean.TemplateMailHelperBean] Failed to send email to xxx@gmail.com
org.springframework.mail.MailSendException; nested exception details (1) are: Failed message 1:
com.sun.mail.smtp.SMTPSendFailedException: 530 Authentication required
        at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1275)   
….


Can anyone help me?

Thanks.
ivan
1 REPLY 1

rivetlogic
Champ on-the-rise
Champ on-the-rise
Hi,

Alfresco core-services-context.xml defines the mailService bean as below.

<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="username">
            <value>${mail.username}</value>
        </property>
        <property name="password">
            <value>${mail.password}</value>
        </property>
        <property name="defaultEncoding">
            <value>${mail.encoding}</value>
        </property>
    </bean>

This does not include all the properties that gmail requires. These configurations are good enough in most settings.

Below is the gmail support page link.

http://mail.google.com/support/bin/answer.py?hl=en&answer=13287.

You could try overriding the mailService bean in your extension as below.  You could get all the properties from any properties file  using org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.


<bean id="mailService" class="org.springframework.mail.javamail.JavaMailSenderImpl">
      <property name="host" value="smtp.gmail.com"/>
      <property name="port" value="465"/>
      <property name="protocol" value="smtps"/>
      <property name="username" value="youraccount@gmail.com"/>
      <property name="password" value="yourpassword"/>
      <property name="javaMailProperties">
         <props>
            <prop key="mail.smtp.starttls.enable">true</prop>
            <prop key="mail.smtps.auth">true</prop>
          </props>
      </property>
   </bean>

Here are some of the alfresco wiki page links that describe overriding spring configurations.

http://wiki.alfresco.com/wiki/Overriding_Spring_Configuration
http://wiki.alfresco.com/wiki/Repository_Configuration



Best regards,
Shagul