问题
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