Jenkins : poll-mailbox-trigger-plugin and SMTP

时光毁灭记忆、已成空白 提交于 2019-12-08 07:00:12

问题


I am unable to get Jenkins to build based on an email using the poll-mailbox-trigger plugin

My setup in E-mail Notification is as follows

  • SMTP server: myExchangeServerHostName
  • Default user e-mail suffix: @companyName.com
  • Use SMTP Authentication: True
  • User Name: DOMAIN\user
  • Password: aboveUserPassword
  • Use SSL: False
  • SMTP Port: 587
  • Reply-To Address:
  • Charset: UTF-8

From here I can successfully send a test email to myself and I receive it.

In my build the Poll Mailbox Trigger settings are as follows

  • Host: myExchangeServerHostName
  • Username: DOMAIN\user
  • Password: aboveUserPassword
  • Advanced Email Properties:
    • mail.imaps.port=587
    • mail.imap.ssl.enable=true
    • mail.imap.starttls.enable=true
  • Schedule: H/5 * * * *

When Testing this connection I get

Connecting to the mailbox... Error : javax.mail.MessagingException: Unrecognized SSL message, plaintext connection?; nested exception is: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:665)

I have tried

  • mail.imap.ssl.enable=false
  • using the email address instead of the domain\user
  • adding mail.imaps.ssl.trust=*

None of the above seem to make any difference.


回答1:


SMTP protocol is for sending and relaying mails. With this protocol one cannot retrieve mails from a particular mailbox. Whereas IMAP and POP3 protocols can retrieve mails.Therefore you will have to obtain access to the IMAP or POP3 server in order to retrieve mails. The poll mailbox trigger plugin of jenkins tries to connect to mailbox via IMAP store. If the mail server is using HTTPS protocol like in an Exchange server, you can write a powershell utility using Microsoft EWS managed api, to retrieve mails and plug that utility into jenkins. Also, Powershell scripts can be included in batch scripts as well which can then be included in jenkins.



来源:https://stackoverflow.com/questions/44148581/jenkins-poll-mailbox-trigger-plugin-and-smtp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!