Setting Up a Mail Session for the Confluence Distribution 设置Confluence分发的邮件会话Set up a mail session for the Confluence distribution to use Gmail as follows:
1,Stop Confluence. Stop
2,Move (don't copy) activation-1.0.2.jar and mail-1.4.1.jar from/confluence/WEB-INF/lib to/<confluence-install>lib. 移动而不是复制
3,Add the following to your server.xml file found in<confluence-install>/conf/ (add it just before the </Context>tag):
注意:<context></context>里面。 </context>标签之前添加一下信息
<Resource name="mail/QqSMTPServer"
auth="admin"
type="javax.mail.Session"
mail.smtp.host="smtp.exmail.qq.com"
mail.smtp.port="465"
mail.smtp.auth="true"
mail.smtp.user="xxxxx@qq.com"
password="yourPassword"
mail.smtp.starttls.enable="true"
mail.smtp.socketFactory.class="javax.net.ssl.SSLSocketFactory"
/>
4,Restart Confluence. restart
5,Choose the cog icon at top right of the screen, then choose Confluence Admin.
6,Choose Mail Servers.
7,Choose either Edit an existing configuration, or Add a new SMTP mail server.登录添加邮件配置
8,Edit the server settings as necessary, and set the JNDI Location as: 添加JNDI的位置 JNDI: java:comp/env/mail/QqSMTPServer
Note : that the JNDI Location is case sensitive and must match the resource name specified in server.xml. JNDI严重区分大小写,并且必须与server.xml中指定的资源名称匹配。
9,Submit, and send a test email. 发送邮件测试.
Atlassian Document: https://confluence.atlassian.com/conf51/setting-up-a-mail-session-for-the-confluence-distribution-336169679.html
写一下我遇到的一些问题:
1,server.xml文件保存的时候另存为要选择格式为UTF-8.因为有可能有时候会报错.
2,添加的邮件信息一定是在<context></context>里面,而不是外面.
3,移动mail-1.4.1.jar文件时,还有一个atlassian-mail-1.4.1.jar这个文件是不需要移动的.
4,com.atlassian.mail.MailException: javax.naming.NameNotFoundException: Name mail is not bound in this Context 参见2