AnsweredAssumed Answered

Found missing params in SMTP Authentication

Question asked by edfactor on Dec 14, 2007
Latest reply on Dec 30, 2007 by edfactor
So what I found in the WEB-INF/classes/alfresco/core-services-context.xml was something like this:

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

But I couldn't send mail invites, the log told me that it was getting an exception, asking me to turn on authentication.  But I thought i did.

What I found on a site about Spring and that pesky JavaMailSenderImpl class is that it likes params like this:

<bean id="mailSender"
      class="org.springframework.mail.javamail.JavaMailSenderImpl">
      <property name="host" value="${mail.smtp.host}" />
      <property name="port" value="${mail.smtp.port}" />
      <property name="protocol" value="${mail.transport.protocol}" />
      <property name="username" value="${mail.smtp.username}" />
      <property name="password" value="${mail.smtp.password}" />
      <property name="javaMailProperties">
         <props>
            <prop key="mail.smtp.auth">${mail.smtp.auth}</prop>
            <prop key="mail.smtp.socketFactory.port">${mail.smtp.socketFactory.port}</prop>
            <prop key="mail.smtp.socketFactory.class">${mail.smtp.socketFactory.class}</prop>
            <prop key="mail.smtp.socketFactory.fallback">${mail.smtp.socketFactory.fallback}</prop>
            <prop key="mail.smtp.timeout">${mail.smtp.timeout}</prop>
         </props>
      </property>
   </bean>

So… I modified my core-services-context.xml file to add that in just like I saw:

<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>
        <property name="javaMailProperties">
       <props>   
        <prop key="mail.smtp.auth">${mail.smtp.auth}</prop>
        <prop key="mail.smtp.timeout">${mail.smtp.timeout}</prop>
          </props>
                </property>
    </bean>

(I only created two of the fields as I am not using SSL - but include those if you want)

Then I went into repository.properties and added those fields (the most important is mail.smtp.auth=true) right after the other mail key-value pairs.  Then I rebooted, and finally… it worked.

Outcomes