How can I configure a different sender email address for each build?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How can I configure a different sender email address for each build?

Aaron Kushner
I'd like the email sender address to be a different group email address for each build type. I use a single Jenkins instance for various builds (hadoop, mysql, various apache projects, etc) and each of these builds has a team responsible for the outcomes and questions.

For example, I'd like the mysql build failure email messages to come from [hidden email] while the hdfs build messages should come from [hidden email].

I looked at the presend option on the email-ext plugin, but had no idea whether I could change the sender with that or how to configure it. 

Any suggestions or help would be appreciated.




Reply | Threaded
Open this post in threaded view
|

Re: How can I configure a different sender email address for each build?

slide
With email-ext 2.22 you should be able to change the sender in the
pre-send groovy script (this is a per project script). It provides
access to the MimeMessage object in the script, see [1] for more
information.

slide

1 - https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin

On Wed, Jun 20, 2012 at 1:36 PM, Aaron Kushner <[hidden email]> wrote:

> I'd like the email sender address to be a different group email address for
> each build type. I use a single Jenkins instance for various builds (hadoop,
> mysql, various apache projects, etc) and each of these builds has a team
> responsible for the outcomes and questions.
>
> For example, I'd like the mysql build failure email messages to come from
> [hidden email] while the hdfs build messages should come from
> [hidden email].
>
> I looked at the presend option on the email-ext plugin, but had no idea
> whether I could change the sender with that or how to configure it.
>
> Any suggestions or help would be appreciated.
>
>
>
>



--
Website: http://earl-of-code.com
Reply | Threaded
Open this post in threaded view
|

Re: How can I configure a different sender email address for each build?

Aaron Kushner
Before posting my questions, I looked through all the templates and code for the mail-ext plugin and was still unclear on how to do this. Can you point me to a script/code that I might have missed. 

On Wednesday, June 20, 2012 1:40:54 PM UTC-7, slide wrote:
With email-ext 2.22 you should be able to change the sender in the
pre-send groovy script (this is a per project script). It provides
access to the MimeMessage object in the script, see [1] for more
information.
Reply | Threaded
Open this post in threaded view
|

Re: How can I configure a different sender email address for each build?

Aaron Kushner
In reply to this post by Aaron Kushner
Here's the answer. Put the following in the pre-send script box.

import javax.mail.Message.RecipientType
import javax.mail.Address
import javax.mail.internet.InternetAddress
import javax.mail.internet.MimeMessage

msg.setFrom(new InternetAddress("[hidden email]"))
Reply | Threaded
Open this post in threaded view
|

Re: How can I configure a different sender email address for each build?

vijay.m Gowda
In reply to this post by Aaron Kushner
super class pre send script working fine with jelly script body

On Wednesday, June 20, 2012 at 4:36:52 PM UTC-4, Aaron Kushner wrote:
I'd like the email sender address to be a different group email address for each build type. I use a single Jenkins instance for various builds (hadoop, mysql, various apache projects, etc) and each of these builds has a team responsible for the outcomes and questions.

For example, I'd like the mysql build failure email messages to come from <a href="javascript:" target="_blank" gdf-obfuscated-mailto="o6TNHRMzlLoJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">mysql-...@... while the hdfs build messages should come from <a href="javascript:" target="_blank" gdf-obfuscated-mailto="o6TNHRMzlLoJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">hdfs-...@....

I looked at the presend option on the email-ext plugin, but had no idea whether I could change the sender with that or how to configure it. 

Any suggestions or help would be appreciated.




--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/070b467e-f6a6-4ac6-b203-b5b91bbd81ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.