Can Jenkins send email taking recepients from a checked out file? - email

I'm quite a new to Jenkins and I'm stuck trying to configure Jenkins to send email based on a file from checked out files.
Basically, I'm checking possibility to migrate our own build system scripts to run under Jenkins. One of the existing requirements is storing project maintainers' emails in a txt file in the repository. Out of the box Jenkins couldn't do that, perhaps some plugin can do the trick?
It would be great if somehow Jenkins (maybe through some plugin?) could send emails based on the information from checked out copy of repository.
Any help, information or a direction of search would be greatly appreciated.

Maybe with the Email Ext plugin which allows you to configure many many things about email :
Triggers - Select the conditions that should cause an email notification to be sent.
Content - Specify the content of each triggered email's subject and body.
Recipients - Specify who should receive a email when it is triggered.
I didn't find the option to directly take the recipient list from a source file, but you can extend easliy this plugin with Groovy or Jelly scripts.

Related

Power Automate - Flow Fails InvalidTemplate- When trying to save attachment to Sharepoint Using Create File

Here is what I am trying to do:-
I want to create a work item in Azure DevOps when an email arrives in my inbox. If the email has an attachment, I want to save that attachment in the SharePoint site folder, retrieve the link of the created file, and update the work item description with the file link.
I have created the flow but when testing, here is what the exception is coming
I am sending this email from Gmail to my organization account. I have researched this problem in existing threads at the Power Automate community as well, but nothing seems to be fit as a potential solution to this problem. Your help in this regarding is highly appreciated.
Thanks.
I resolved this issue by creating a new flow, in this case, please make sure, you are updating the configuration of outlook email to say "Include Attachments" - "yes".
Please refer to screenshot below
If you will not include it, it will be treated as null, when you will be trying to create a file at SharePoint using power automate.
Hope this helps everyone.
Thanks,
Bee

How do I send html email with work items delivered from last build in VSTS?

I am trying to automate the release workflow by using VSTS pipelines, the component which i need to deliver is basically a library.
The VSTS pipeline is now building the Visual Studio solution and generating the binary files in the artifacts folder, but i need to send an email to the QA team with the list of work items which have been delivered as part of the release.
I have found a VSTS task in the marketplace which generates the release notes using MD files:
https://marketplace.visualstudio.com/items?itemName=richardfennellBM.BM-VSTS-GenerateReleaseNotes-Task&targetId=b4f49e36-84e5-48a6-b338-51f8ecc1d8d7
However, what I need is a task based on a customizable HTML template and send in the attachments a ZIP file with the content of the artifacts folder.
Anyone know how could i implement this behaviour as part of the pipeline?
How do I send html email with work items delivered from last build in VSTS?
In fact, you have already found the answer, just need to go one step further.
In the Usage and Description of Types of Template about that extension, you could get the following instructions:
but it also possible to generate other formats such as HTML with
appropriate templates.
The use of a template allows the user to define the layout and fields
shown in the release notes document. It is basically a markdown file
(or other format of your choice)
So, this extension should supports HTML format.
As test, I add that task with html template file build-basic-template.htm:
Note: Set the Output file with .htm format and template here (I use the first one).
Besides, if you want to seed email with this .htm file, you could use the Build Notification task or Send email task.
Hope this helps.

powershell - link to attached file in mail message

I can't find the solution for my problem. So, in my send-mailmessage html body is field that should be redirected to file which is included as attachment in message. How can I create hyperlink to that file in mail, when client opens it?
I don't know if you get my idea. In other words, in message I have attached file, and then there is field which should be a hyperlink to attached file. When client receives message he/she should press the link and then attached file opens.
I searched almost everything in everwhere but can't find a appropriate solution how to solve this.
This isn't really a PowerShell question, since this issue has nothing to do with the functionality of the Send-MailMessage cmdlet.
In any case, the reason you can't find a solution anywhere is that what you're trying to do is impossible. There is no way that a hyperlink in an e-mail message can point to a file attached to that message. Different mail clients on different operating systems store attachments in different locations. Even if you want to assume that all your recipients are running Outlook on Windows, there are different versions of both. Even if you know for a fact that all recipients are running a specific version of Outlook on a specific version of Windows, you're still out of luck. Outlook stores attachments in a subfolder in the Temporary Internet Files in the user's profile that has a randomly generated name. There's no way to inject code into a hyperlink in an email message, so without knowing the exact local file location, you can't link to it.
I suppose if you're really determined you could have the hyperlink point to a web page that runs some complex javascript code that tries to figure out where the attachment is stored, but that's a major undertaking, and would break if the recipient's default browser has javascript disabled.
Which begs the question, why exactly are you trying to do this? So that recipients can click once instead of having to double-click to open the attachment?
I have found that you can make a hyperlink point to a file share that you know the recipients have access to.
To do so:
Simply make each hyperlink point to the specific file and there you have it.
They have to have permissions to access that file share, or there is a much better way now that I haven't thought of.
Oh well, this works for me, for now.

Can Jenkins send more than one email?

After the build I want to trigger two e-mails.
The first one is an email to SharePoint server. SharePoint uploads its attachments. The subject of this mail must match a SharePoint folder for uploading.
The second one is a mail for team. So, it should have nice subject rather than folder name.
How can I make Jenkins send two emails?
There is no plugin that provides this functionality. You have two choices to accomplish this functionality. You could implement your own plugin. A good place to start would probably be the email-ext plugin.
Alternatively, you could trigger the first email with the actual build and then have Jenkins trigger a separate, dummy build that sends the second email. This wouldn't be as elegant, but much easier as you wouldn't need to implement any functionality yourself. Depending on what exactly you want the emails to contain, you might have to transfer some data from the first to the second build (e.g. via a parameterized build).
A cheap alternative is to create "shell script" Build steps, e.g.: (if on *nix platforms)
echo "Please Mr. SharePoint, would you be so kind to attach my file(s) ?
Thanks!" | mail -s "<folder name>" -a ${WORKSPACE}/target/artifacts/myfile sharepoint#example.com
You can also add a new trigger and have the option to send a new email with new content to the recipient list.

NMH API: how to write a script to send a message that is in a draft folder?

I'm trying to use nmh's "draftfolder" feature to queue outgoing mail for later delivery.
The key step I don't know how to implement is how to write a program that will send a message from a draft folder.
Here's the workflow I'm trying to achieve:
I compose a message using the comp or repl programs, and I quit with the message unsent, leaving it in the "draft folder" +delay4.
Sometime after four hours have elapsed, a cron job comes along and sends the message, removing it from the draft folder.
Here are the difficulties I'm having with existing MH commands
The comp -use command can send an existing message from a draft folder, but it requires interaction. I want to do this noninteractively from a cron job, and I'd prefer not to try to write an expect script. I tried
comp -use -noedit -nowhatnowproc
but that did not send the message. I don't know if some kind of alternate whatnow program would do the trick.
The send and post commands look promising, but both expect to operate on files, not messages in folders. Maybe send followed by rmm works, maybe it doesn't.
I could go direct to sendmail, but then I would have to figure out whether to run mhbuild or not. And I would seem to have the same issue of needing to remove the message from the folder.
My question is how can I use the MH API in a script to send a message that is sitting in a draft folder?
RTFM.
The send command's -draftfolder option makes it work on messages, not files.
Perfect for what I want. If you want to be extra explicit, use the -draftmessage option as well.