How can I attach a file to the email in Jenkins? - linux

I have a problem now with Jenkins Email. I tried to attach a file like demo.html in the $WORKSPACE. But it didn't work. I just received an email with build.log attached. Could someone figure out what's the problem?
I am now doubting that the email is processing in Jenkins master, and my job is working in slave. Is that the reason?
Here is Attachments filed in Editable Email Notification. I filled it with "*.html"
============
Attachments *.html
============
I also tried ./*.html in Attachments field, but with no luck.
A part of build log:
completed with result SUCCESS
Checking if email needs to be generated
Email was triggered for: Success
Sending email for trigger: Success
NOT overriding default server settings, using Mailer to create session
messageContentType = text/plain; charset=UTF-8
Request made to attach build log
Adding recipients from recipient list
Adding developers
Successfully created MimeMessage
Sending email to: test999922#hotmail.com
Finished: SUCCESS

I found the reason.
The html is in the salve's workspace not in master's workspace. So jenkins cannot find it.
When I restrict it run on slave, the problem is resolved.

Related

I want to send email attachment using nodemailer in node js.i am using elasticemail gate way

I need to send a URL attachment in nodemailer.i try to many ways but mail was not deliverd.I was seen elasticemail gateway they showed a error like this "suppressed" how will i solve this issue
attachments:[{ // use URL as an attachment
filename:'GSTR3B_33ADQFS8223E1ZY_012019_1551501263.pdf',
path:'my url'}]
if you are getting "suppressed" from Elastic Email check in the Contacts section on your dashboard to be sure that the contact is in an "Active" state. The contact might be suppressed by the system.

How to get default log details of lotusscript agent

I developed an notes application called "agent monitoring" which will trigger email daily when the schedule agent prints an error in the log.nsf file.
2017-03-28 09:39:42 AMgr: Agent ('GoSAP' in '\DomApps\GoSAP.nsf') error message: MQJE001: Completion Code '2', Reason '2033'.
I search for details using an "error message" regular expression string in the log and then send email.
Now I would like to handle when the agent hangs. I think it can be done if we get details from the default agent log as shown here.
Can somebody please guide me on how to achieve this?
[EDIT]==> look at #Richard Schwartz response, it seems possible with NotesDXLExporter.
[Original response]
This is not possible programmatically in Notes.
Remark: if you have a client running, you can use sendkey (windows dll not the notes function that is buggy) to display the log.
This question has also been asked years ago in experts-exchange
also without solution there.
The agent log can be accessed this way.
For eaach database that you are interested in, set up a NotesNoteCollection with SelectAgents=true and call BuildCollection.
Iterate through the collection with getFirstNoteId/getNextNoteId and get the agent notes via GetDocumentByID
Use NotesDXLExporter with the agent note as input to generate XML, then parse the XML and read the <trigger type> and/or <agent name> data to determine if you care about the agent. If it's a scheduled agent that you want to monitor, then look at the <runlog> data.

Node.js: AWS SES sendRawEmail: mails not getting sent to BCC addresses

I am sending a mail with attachments using mailcomposer and the sendRawEmail method of the AWS SDK. I am able to send the emails using the to and cc fields but when I add an address in bcc, the mail does not get delivered. There is no failure though. Is there any extra configuration not mentioned in the docs that I might be missing ?
I found the answer in one of the issues of mailcomposer. You need to add one extra config in the mail options.
var mail = mailcomposer(options);
mail.keepBcc = true;

Get build requestor using Groovy script (Jenkins / email-ext)

I want to get the username and/or email address of the build requestor in a post-build script.
Sidenote: I want the requestor so I can set the email sender of the post-build email notification dynamically in the email-ext plugin's pre-send script.
AbstractBuild has built-in support for AbstractBuild.getCulprits() and AbstractBuild.hasParticipant(User user) but I can't find a method for retrieving the requestor. I can't find any useful reference in reference list to the User class either.
I managed to solve it via the Cause of the the build, as recommended in this answer.
The reason that the build requestor can be found in the cause for a build makes perfect sense when you think about it: Not every build is directly triggered by a user.
If it is triggered by a user, the list of causes for the build contains a Cause.UserIdCause, with the user's id and name.
This code snippet worked for me. It extracts the username from the build via the cause and sets the From and ReplyTo headers. I use it in the pre-send script of the email-ext Jenkins plugin.
import javax.mail.internet.InternetAddress
cause = build.getCause(hudson.model.Cause.UserIdCause.class);
username = cause.getUserName()
id = cause.getUserId()
email = new InternetAddress(String.format("%s <%s#example.com>", username, id))
msg.setFrom(email)
msg.setReplyTo(email);

Mailer Error PHP

i have created a PHP feedback form for my website. but it got error when i click the button submit. It said that "Could not instantiate mail function. Mailer Error: Could not instantiate mail function.". I have tried many time for solving this problem.
My server is Windows server which is i am using PARALLEL HELM.
My Website link with feedback form is http://vivalife.com.my/home/index.php/contact-us/feedback-form/
I hope that anyone can solve my problem.
Thank you
I suppose phpmailer is an external class... And it's trying to use the PHP mail function. First of all check that your server has mail() function enabled.
To do so, I recommend doing something like this, on a php test file:
if (!mail(......)){
// show error for debugging.
}
If Mail Function - PHP is enabled, you should check the SMTP configuration on your php.ini file...
Let us know.

Resources