Can Jenkins send more than one email? - 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.

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.

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

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.

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.

Send To/Mail Recipient from WSH

I am trying to implement in windows scripting host the same function as windows Send To/Mail Recipient does. Did not find anything usefull on google except steps to instantiate Outlook.Application and directly calling its methods.
I need to go the same path as windows do, as there is a mix of Outlook and Lotus Notes installed, I don't see it good to perform some sort of testing and deciding which object to talk to...
What I have found is that the actual work is done by sendmail.dll, there is a handler defined in registry under HKEY_CLASSES_ROOT\CLSID\{9E56BE60-C50F-11CF-9A2C-00A0C90A90CE}. I would like either to use this dll somehow or to simulate the same steps it does.
Thanks for your input.
I found one item on CodeProject from 2003 that might be relevant.
The contents of the sent to menu in Windows is a bunch of files (usually links) in the C:\Documents and Settings\username\SendTo folder. You need to add your script - or a link to it - there.
For your script you could check if certain registry keys exist to detect Outlook and Lotus Notes.
Or if you don't care if the message shows up in sent items, just use CDOSYS.NewMail to send the message directly to the SMTP-server.
CDOSYS documentation