I’ve been struggling with this for some time, in part no doubt, due to my limited knowledge of JavaMail. But, I always make up for lack of (knowledge, intelligence, experience) with pure stubbornness. Anyways, just thought I’d record it here, since it seems there are others struggling with it as well.
I had set up a Gmail account that I wanted to use to with an Alfresco installation. Here is some basic information (not that I think it matters).
- Server: Debian Etch (odd packages from lenny and sid)
- Alfresco: Alfresco Tomcat Community 2.1.0
- JDK 6: package from Sid (aptitude search/show it to get the gory details)
There are exactly two files you need to edit to get STMP with Gmail to work. They are both located in /opt/alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco (assuming that you installed Alfresco in /opt/alfresco.
The first is repository.properties. Open in your favorite vi clone and search for mail: Modify to look like this:
# Email configuration
mail.host = smtp.gmail.com
mail.port = 465
mail.transport.protocol = smtp
mail.username = firstname.lastname@example.org
mail.smtp.auth = true
mail.smtp.socketFactory.port = 465
mail.smtp.socketFactory.class = javax.net.ssl.SSLSocketFactory
mail.smtp.socketFactory.fallback = false
mail.smtp.timeout = 25000
mail.smtp.starttls.enable = true
There, half the job is done. You will obviously need to modify the username and password (no email@example.com/asecretpassword will not work).
Now vi core-services-context.xml, find the section on mail (you can search for MAIL to find it quickly). Modify it to look as follows.
<!— MAIL SERVICE —>
<bean id="mailService" class="org.springframework.mail.javamail.JavaMailSenderImpl">
You should now be set.
- Create a user for yourself if you haven’t already done so. Make sure you entered a valid email address in the email field (modify user if you didn’t).
- Select an existing space or create a new one. View space details.
- Find the option Manage Space Users and select it
- Invite a user. Select your user, and whatever role you want. Make sure you say Yes to sending an email to the user.
- When you are done and click finish, your user should have been added as a space user. If Alfresco freezes for a long time here then something is wrong and you need to go back and fix things.
- Check your personal email. There should be a mail from your Alfresco email user.
Good you are done, go and collect your money. Buy yourself a beer. And buy one for me too!