Send email with Expiration date from Jenkins

45 views
Skip to first unread message

Sinai Rijkov

unread,
Jan 20, 2016, 4:30:43 AM1/20/16
to Jenkins Users
Hi,
 I need to use Expiration date,when I'm sending email from plugin.



I've found ,that i can use some plugin,where we can edit headers - Email-ext plugin
How I can use Email-ext plugin for Jenkins and add custom header, like Expiration date?

But any moresuggestions will be welcome. :)




Example:

Expiry-Date:  header.
 
sendmail from CentOS:


echo -e "Content-Type: text/plain\r\nExpiry-Date: Fri, 20 Jan 2010 18:00:00 +0200 From: jen...@mycompany.com\r\
nSubject: Test\r\n\r\nTest with expiration for tomorrow 20 Jan 2016" | sendmail -f sen...@gmail.com  desti...@gmail.com


So at Outlook you can see like this:



Inline image 1

Slide

unread,
Jan 20, 2016, 7:44:32 AM1/20/16
to Jenkins Users
The easiest way to do this would be to use a presend script and add the header there on the msg object, which is an instance of MimeMessage. You can look at the docs for that and the presend script feature in email-ext to determine what you need to do.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/213adcaa-4c61-4bee-8b5b-906eb65682ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sinai Rijkov

unread,
Jan 21, 2016, 5:24:46 AM1/21/16
to Jenkins Users
Hi. Thank you.
added just one line to Pre-send Script and it worked for me:

import jenkins.*;
import hudson.model.*;
import jenkins.model.*;

msg.setHeader('Expiry-Date', 'Fri, 22 Jan 2016 18:00:00 +0200');

...
Reply all
Reply to author
Forward
0 new messages