问题描述
我的问题是这样的后续行动:
这是我的情况:
我有一个groovy脚本,它构造了将要发送的电子邮件。
只要我将脚本直接写入(代码),就可以正常工作:
如果我把这个脚本放在Jenkins文件系统中(... jenkins \\ \\电子邮件模板)为:电子邮件presend.groovy 和我尝试调用它:
< presendScript> $ {SCRIPT,script =email-presend}< / presendScript>
我得到错误消息,我无法访问消息对象:
行上的代码:
msg.addHeader(X-Priority,1(Highest));
msg.addHeader(重要性,高);
我错过了一些明显的东西,找到任何代码片段,这是否做到了这一点?
我想使用javax.mail.Message msg,如果代码直接在jenkins中,则可用。
太糟糕了:(
)My question is kind of a follow up of this:How to place Email-Ext groovy script on the jenkins file system
Here is my situation:I have a groovy script which constructs the email which will be send.This works fine as long as I have the script directly written (the code) in:
If I take this script, place it in the Jenkins filesystem(...jenkins\email-templates) as: email-presend.groovy and I try to call it with:
<presendScript>${SCRIPT, script="email-presend"}</presendScript>
I get the error message, that I can't access the message object:
Code on the line:
msg.addHeader("X-Priority", "1 (Highest)");
msg.addHeader("Importance", "High");
Am I missing something obvious, since I can't find any code snippet which did this?I want to use the javax.mail.Message msg which is available if the code is directly in jenkins.
Unfortunately it seems like it's not possible according to this post:Email-ext comment
Too bad :(
这篇关于在groovy脚本中的Email-Ext对象作为文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!