Configuring GMail for Outgoing Mail (SMTP)
2010-10-20 13:22
429 查看
Configuring GMail for Outgoing Mail (SMTP)
Follow the instructions from Configuring JIRA to Send SMTP Mail:
Download OpenSSL:
Linux
: http://www.openssl.org/
Windows
: http://gnuwin32.sourceforge.net/packages/openssl.htm
Import the SSL certificate from Gmail:
For Windows
: double-click the openssl file from the directory that gets installed. Run
s_client -connect smtp.gmail.com:465
For Linux
: run:
openssls_client -connect smtp.gmail.com:465
From the output, you want only the alphanumeric string between the lines
which say 'BEGIN CERTIFICATE' and 'END CERTIFICATE' (inclusive
). Copy
the results into a file called gmail.cert using your favorite text
editor.
Exit the openssl prompt, and return to your Java installation's bin
directory. Import the cert into your keystore:
"A keystore is created whenever you use a -genkey, -import, or -identitydb command to add data to a keystore that doesn't yet exist. More specifically, if you specify, in the -keystore option, a keystore that doesn't yet exist, that keystore will be created. If you don't specify a -keystore option, the default keystore is a file named .keystore in your home directory. If that file does not yet exist, it will be created." From Sun´s Documentation on Keytool |
:
keytool -import -alias smtp.gmail.com -keystore $JAVA_HOME/jre/lib/security/cacerts -file C:/path/to/gmail.cert
Fore Linux
:(use the keytool under $JAVA_HOME
)
sudo keytool -import -alias smtp.gmail.com -keystore $JAVA_HOME/jre/lib/security/cacerts -file /path/to/gmail.cert
The default keystore password is 'changeit'. 如果导入失败,可以尝试换-keystore 后面的路径,或者将cacerts删掉后再导入(删除可能会影响其他cert) |
( not copy! ) the activation and mail jar files from
the /WEB-INF/lib folder to the /common/lib (Tomcat 5.5) or /lib (Tomcat
6) folder.
Add Gmail as a JNDI Resource in /conf/server.xml in-between JIRA's
<Context>...</Context> ( after line 49 ). Change your
username and password:
<Resource name="mail/GmailSmtpServer" auth="Container" type="javax.mail.Session" mail.smtp.host="smtp.gmail.com" mail.smtp.port="465" mail.smtp.auth="true" mail.smtp.user="myusername@gmail.com" password="mypassword" mail.smtp.starttls.enable="true" mail.smtp.socketFactory.class="javax.net.ssl.SSLSocketFactory" />
Add
-Djavax.net.ssl.trustStore=$JAVA_HOME/jre/lib/security/cacerts to JAVA_OPTS(, or
JAVA_OPTS="-Djavax.net.ssl.trustStore=$JAVA_HOME/jre/lib/security/cacerts $JAVA_OPTS"
to the top of bin/setenv.sh)
Configure the SMTP server in JIRA's interface, use the JNDI setting. The proper value (if using the default example), is:
java:comp/env/mail/GmailSmtpServer
restart jira
相关文章推荐
- Incoming and Outgoing Mail Server Settings for Hotmail, Yahoo! Mail, GMail, MSN, AOL and more
- 开发日志之我所遇到的javax.mail.NoSuchProviderException: No provider for SMTP问题
- Spring – Sending E-Mail Via Gmail SMTP Server With MailSender--reference
- Zend Framework Send Mail For Gmail
- javaMail邮件问题:java.lang.SecurityException: SHA1 digest error for com/sun/mail/smtp/SMTPTransport.class
- 邮件发送以及javax.mail.NoSuchProviderException: Unable to locate provider for protocol: smtp解决方案
- simple mail example for smtp debug
- Configuring git send-email to use Gmail SMTP
- Send mail using Gmail SMTP in Magento
- Zend_Mail收发smtp(gmail,163)邮件Zend Framework
- Why can't Gmail forward outgoing mail?
- JavaMail API – Sending Email Via Gmail SMTP Example
- Use PHP mail function with IIS SMTP Server in Windows for Local Testing Purpose
- centos mail使用外部SMTP发送邮件
- 如何用Java来编写可根据SMTP和POP3协议来收发E-mail的Java Applet。
- PHP的一个完整SMTP类(解决当mail()遇上邮件服务器需要验证时的问题)
- Note 455140 - Configuration of e-mail, fax, paging or SMS using SMTP
- Why the marketing of Gmail lags behind MSN mail?
- ExtMail Solution HOWTO for Linux
- RainLoop Webmail – A Modern Fast Web Based Email Client for Linux