DEV Community

Raghwendra Sonu
Raghwendra Sonu

Posted on

Trigger a Job with Email in Jenkins

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

Top comments (0)