DEV Community

loading...

Trigger a Job with Email in Jenkins

raghwendrasonu profile image Raghwendra Sonu ・1 min read

In this article we are going to see, how to trigger a Jenkins job with Email. We will be using Jenkins Poll Mailbox Trigger Plugin for this purpose.

Goto Manage Jenkins, in your Jenkins instance and install this plugin.

Alt Text

Now, create a freestyle job and in the configuration add below in "Poll Mailbox Trigger" settings:
host: imap.gmail.com
UserID: < enter your gmail userid >
Password:< enter your gmail password >
Advanced Email Properties: subjectContains=Trigger_Job_Demo
Schedule: H/1 * * * *
Attachments: Ignore

So, it will check email account for unread emails in every one minute and if any email with subject "Trigger_Job_Demo" is found it will trigger the job.

Alt Text

To test this, send an email from your account with given subject. And, the job at Jenkins will be executed.

Read more here: https://github.com/jenkinsci/poll-mailbox-trigger-plugin

Discussion (0)

pic
Editor guide