2012-11-22 26 views
9

配置詹金斯電子郵件通知我試圖配置詹金斯發送電子郵件通知與Gmail的POP供應商,但我不能成功與Gmail

SMTP server - pop.gmail.com 
Default user e-mail suffix - @gmail.com 
Sender E-mail Address - Foobar CI <[email protected]> 

Use SMTP Authentication - yes 
User Name - your.email 
Password - p******d 

Use SSL - yes 
SMTP Port - 995 
Reply-To Address - [email protected] 
Charset - UTF-8 

測試失敗:連接被拒絕

javax.mail。 MessagingException:無法連接到SMTP主機:pop.gmail.com,端口:995; 嵌套的例外是: java.net.ConnectException:連接被拒絕:連接

+0

你可以嘗試'的telnet smtp.gmail.com 995 '看看端口是否打開 –

+0

確實我試過:telnet smtp.gmail.com 465或telnet pop.gmail.com 995,並且在這兩種情況下,我的連接都失敗了。我該怎麼辦 ? –

+0

很好,如果telnet失敗,這顯然意味着你的防火牆阻塞了出站端口。你需要和你的網絡管理員一起解決這個問題。 –

回答

25

對谷歌的SMTP服務器的主機名是smtp.gmail.com,如果您使用SSL,那麼正確的端口是465

POP服務器通常只用於接收郵件,而不是發送郵件。

+0

事實上,如果我使用smtp.gmail.com,也會得到同樣的錯誤。我試過 –

+0

正如普拉克阿格拉瓦爾寫的,在這種情況下,你可能在你的服務器和互聯網之間有一個防火牆,它阻止了這個端口。 – dunni

15

以下是更新Gmail的SMTP服務器的配置:

Gmail SMTP server address: smtp.gmail.com 
Gmail SMTP user name: Your full Gmail address (e.g. [email protected]) 
Gmail SMTP password: Your Gmail password 
Gmail SMTP port: 465 
Gmail SMTP TLS/SSL required: yes 

此配置是爲我工作的罰款。

+1

此處提供:https://support.google.com/mail/answer/13287?hl = zh_CN –

8

上述配置沒有工作,因爲谷歌增加了安全措施。 要從中觸發郵件的Gmail帳戶需要額外的配置。此步驟授權Jenkins等應用程序使用Gmail帳戶。

https://support.google.com/accounts/answer/6010255

轉到我的帳戶「不夠安全的應用」一節。 在「訪問安全性較低的應用程序」旁邊,選擇啓用。 (G Suite用戶的注意事項:如果您的管理員鎖定了安全性較低的應用帳戶訪問權限,則此設置處於隱藏狀態。)

此電子郵件成功觸發後。

+0

雖然此鏈接可能會回答問題,但最好在此處包含答案的重要部分,並提供供參考的鏈接。如果鏈接頁面更改,則僅鏈接答案可能會失效。 - [來自評論](/ review/low-quality-posts/11740175) –

+0

@MartinZabel已更新。 – btpbtp7

1

以下屏幕截圖顯示了您需要從GMail發送電子郵件所需的電子郵件配置。

The following screenshot illustrates the e-mail configuration you'd need to do to send e-mails from GMail.

0
  1. 獲取專用密碼

    • 唱到Gmail帳戶>>導航到設置>>隱私和安全設置

    • 設置兩步驗證設置(因爲沒有兩步驗證,我們無法生成應用程序在Gmail帳戶設置兩步驗證設置後的N專用密碼)

    • 導航回到安全和隱私設置

    • 點擊應用專用密碼>>給在下拉菜單中應用程序的名稱下來,詹金斯(默認情況下Google不會對詹金斯的任何特定的應用程序密碼設置) >>這將產生密碼記下密碼生成

注意由於密碼有超過你的整體控制Gmail帳戶披露有可能導致嚴重的後果

  • 發送Gmail的

    設置SMTP配置
    • 從儀表板 登錄後以下路徑導航管理Jenkins >>configure system >>scroll down to email notification section

    • 輸入以下參數

      smtp server : smtp.gmail.com 
      default user email suffix : @gmail.com 
      
    • 選擇高級

    • 檢查SMTP認證

      username : (Your gmail id) 
      password : (application specific password generated from previous step) 
      
    • 檢查使用SSL

      SMTP port : 465 
      Reply to address : [email protected](optional) 
      Charset : UTF-8 (by default it is UTF-8) 
      
    • 選擇測試配置郵件

      Test e-mail recipient : <enter recipient email id > 
      
  • 測試設定點擊將發送一個測試郵件到收件人的電子郵件ID