Jenkins Ext email showing address not configured yet - even after setting up the System admins email - email

Jenkins Version : 2.251
I have configured the Extended E-mail Notification in my Jenkins and setup the System Admin e-mail address under Jenkins Location like this (e.g. "Jenkins Daemon <foo#acme.org>").
When I do a Test configuration by sending test e-mail, I'm getting a test mail from Jenkins with proper address.
But when my Job triggers a mail after completion, its coming as address not configured yet.
Please help me to solve this.
Thanks in advance.

I was also facing the same issue.
I was able to do it successfully with:
Freestyle job:
Add Post-build action > Editable email notification( from Email Extension plugin) >
The "project from" field > thesender#test.comzz
Declarative pipeline:
emailext body: 'abcd', from: 'thesender#test.comzz', replyTo: 'justTest#test.comzz', subject: 'test1', to: 'youremail#test.comzz'

Related

Jenkins email plugin doesn't send email to user who broke the build

I've setup Jenkins to send emails only to users who broke the build using email-ext plugin, but I'm getting this error:
Not sending mail to unregistered user user#example.com because your SCM claimed this was associated with a user ID ‘John Smith' which your security realm does not recognize; you may need changes in your SCM plugin
I don't really understand what this error means, is the problem in our SCM, or in the email plugin? The emails are taken from the commit history, should I register them somewhere so Jenkins will start working?
For reference, this is the code around the error message in the plugin's source code:
} catch (UsernameNotFoundException x) {
if (SEND_TO_UNKNOWN_USERS) {
listener.getLogger().printf("Warning: %s is not a recognized user, but sending mail anyway%n", userAddress);
} else {
listener.getLogger().printf("Not sending mail to unregistered user %s because your SCM"
........
How do I enable SEND_TO_UNKNOWN_USERS?
The error message is also mentioned in this bug report.
For version V2.61 or above this can be configured via a radio button.
Go to
Manage Jenkins -> Configure System -> Extended E-mail Notification
and tick the radio button for Allow sending to unregistered users
Edit: If this does not work, see https://stackoverflow.com/a/45353810/492336 for another solution.
OK, after some experiments this is what I found out:
Jenkins takes the email part of the committer (not the author). For example for a commit message that looks like that:
Author: John Smith <author1#example1.com> 2017-07-27 17:15:39
Committer: John Doe <committer1#example2.com> 2017-07-27 17:15:39
Parent: 9c3ff18dda8ca6f7b7ac4ebab4c76d3c85891a33 (commit)
Branch: master
Jenkins will take "committer1", and create a brand new user under People with User ID "committer1" and email "". Unless that user has a password however, it will be considered unregistered so you need to go to Configure for that user and add a password field to it:
So this is one way to fix the error, but you have to do it for every user and in a big team it can be tedious.
Put the line bellow in your jenkins startup script
-Dhudson.tasks.MailSender.SEND_TO_UNKNOWN_USERS=true
The newest Jenkins security directive only allow sending mail to registered user. The line above bypass this configuration.
Given jenkins takes the first part of the email address and creates a user, I made my team have their jenkins user name be the first part of their email address. This removed any overhead of having to maintain two separate users.

Sitecore custom MTA for localhost

I am trying to figure out EXM for Sitecore. I installed it and now I am trying to configure it to send emails from my local machine. SAC MTA is not an option because I don't have access to App Center. I am left with custom MTA.
I was trying to configure config files to use gmail smtp:
Sitecore.EDS.Providers.CustomSmtp.config
<smtpSettings type="Sitecore.EDS.Core.Net.Smtp.SmtpSettings, Sitecore.EDS.Core" singleInstance="true">
<server>smtp.gmail.com</server>
<port>465</port>
<userName>*****#gmail.com</userName>
<password>*****</password>
<authenticationMethod>Login</authenticationMethod>
<startTls>true</startTls>
<proxySettings ref="exm/eds/proxySettings" />
</smtpSettings>
Sitecore.EDS.Providers.CustomSmtp.Sync.config
<pop3Settings>
<pop3Setting type="Sitecore.EDS.Core.Net.Pop3.Pop3Settings, Sitecore.EDS.Core" singleInstance="true">
<server>pop.gmail.com</server>
<port>995</port>
<userName>****#gmail.com</userName>
<password>****</password>
<useSsl>true</useSsl>
<startTls>true</startTls>
<proxySettings ref="exm/eds/proxySettings"/>
</pop3Setting>
</pop3Settings>
But when I try to "send quick test" through EXM I get "Failed to connect to the email server. Please try again later". Can anyone help me with that configuration. And is it even possible? I remember reading something about paid license to use custom MTA. Would it mean, that you need to pay to send email via EXM?
To switch from using the Sitecore MTA to using the Custom SMTP, you must disable the Dyn configurations and then enable the CustomSmtp configurations:
In the Website\App_Config\Include\EmailExperience folder, add the suffix .disabled to the end of the following file names:
Sitecore.EDS.Providers.Dyn.config
Sitecore.EDS.Providers.Dyn.Sync.config
In the  Website\App_Config\Include\EmailExperience folder, remove the suffix .disabled from the following file names:
Sitecore.EDS.Providers.CustomSmtp.config.disabled
Sitecore.EDS.Providers.CustomSmtp.Sync.config.disabled

In coming emails not updating issue fields in Redmine

I am trying to set up Redmine so that it can receive emails to create tickets .
The command I use to fetch emails is
rake --trace redmine:email:receive_pop3 RAILS_ENV="production" host=my.mail.server port=110 username=born#mydomain.com password=***** project=foobar
email contents are like
Project: foobar
Tracker: Bugz
Status: New
Priority: Normal
On receiving this email redmine created a new ticket . However files Tracker,Status and Priority is not getting updated with the values from email . Instead the entire email body is getting updated in Description field of the new ticket.
Are my emails not in the correct format ?
Redmine only allows setting attributes from the mail body which are explicitly enumerated on the command line.
You can specify which attributes are allowed to be set using the #allow_override# argument to the rake task similar to this:
rake redmine:email:receive_pop3 RAILS_ENV="production" ... allow_override=project,tracker,status,priority
Please see the documentation at http://www.redmine.org/projects/redmine/wiki/RedmineReceivingEmails#Issue-attributes for details.

How to send an email with Ansible

I'm trying to send an email using Ansible, but I can't understand how it works as I don't know how to provide user and password for such service (not specified in the documentation).
Both my machine and the email server are in the same network, but I need to be authenticated in order to send the email.
This is my yml file:
---
- name: Testing email
hosts: localhost
tasks:
- name: Send email
local_action: mail
host=mail.server.com
port=993
subject="Ansible test mail"
body="Testing email"
from=my#email
to="y#email
charset=utf8
And this is the related content of the hosts' file:
[localhost]
localhost ansible_connection=local
Any idea about how should I configure it? Thanks in advance.
Looking at the source code for the mail module ( https://github.com/ansible/ansible/blob/d1effecb2ef073e478c67a7ca39cf56708a66a48/library/notification/mail ) it doesn't look like it supports SMTP authentication.
It shouldn't be too hard to add support for it however. It would require adding the username and password parameters to the module, detecting if they've both been supplied, and if so, calling smtp.login() with those parameters.
In fact, it looks like there's two pull requests to do exactly that at the moment here
https://github.com/ansible/ansible/pull/7213
and here
https://github.com/ansible/ansible/pull/6667
So support will most likely be added in dev soon.

Jenkins : Email Notification : Latest build status URL in the mail body

I use Jenkins extended email notification plugin to get an email after a build finishes...
and when i get the mail i see URL which gives the latest changes done to the build for ex:something like: <://abcd.l%20Automation%20-%20IE8%20Browser/changes>...
Instead of this i would like to see the URL in the mail which directly gives the build status
for ex: some thing like://abcd.l%20Automation%20-%20IE8%20Browser/buildnumber>...so that clicking on this URL should directly open the build status page....
is there any way we can configure with the jenkins ?
I have default content being set as below : $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
Check console output at $BUILD_URL to view the results.
please let me know ...
musaffir
$BUILD_URL should work.
Please check "Advanced Settings" of "Editable Email Notification" plugin in your job. You might have overridden the default settings of "Failure" trigger