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.
Now, create a freestyle job and in the configuration add below in "Poll Mailbox Trigger" settings:
UserID: < enter your gmail userid >
Password:< enter your gmail password >
Advanced Email Properties: subjectContains=Trigger_Job_Demo
Schedule: H/1 * * * *
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.
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