Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jenkins do not send emails to multiple recipients

Tags:

jenkins

I use Jenkins email-ext plugin to send emails when a build starts. When I specified only one recipient of such emails, everything worked smoothly - I got emails.

But when I specified more recipients Jenkins stopped sending emails, despite in builds' logs I can see they are being sent (I do not get them)

Isee the following message in a build's logs: "Sending email to: [email protected] [email protected]". I do not see any errors there.

like image 435
user3712245 Avatar asked Jun 18 '14 16:06

user3712245


People also ask

How would you ensure a delivery is not sent to multiple recipients with the same email address?

Bcc, or “blind carbon copy” functions the same as “Cc”, with one difference: Bcc-ed addresses are hidden from all recipients. Both features are available in Gmail and Outlook. To send the same email separately to various users in Outlook follow the guide below. Find and add the Bcc field for your message.

What happens when I sending an email to multiple receivers?

You can send a mass email to more than one recipient using the BCC feature. Click the compose box, after composing your message, click on BCC and add all your recipients. This will send the emails to the recipients keeping email addresses hidden from each other.

How do I use editable email notifications in Jenkins?

For a project to use this plugin, you need to enable it in the project configuration page. In the Post-build Actions section, click on Add post-build action and then select Editable Email Notification. There are three main fields that you can edit when this plugin is enabled: Project Recipient List.


1 Answers

I was also wondering why when one email was given it worked and when multiple email addresses were given separated by commas ',' it didn't. Managed to make it work.

This is what worked for me

pipeline {
        agent any

        environment {
            EMAIL_INFORM = '[email protected];[email protected]'
        }


        stages {
        }

        post {

            success {  
                emailext body: 'Check console output at $BUILD_URL to view the results.', 
                        to: "${EMAIL_INFORM}", 
                        subject: 'Jenkins - Released $PROJECT_NAME - #$BUILD_NUMBER'
            }

        }
    }

You should use semi colons ';' rather than commas ',' when invoking "emailext" via declarative syntax in pipeline.

Hopefully it works now.

like image 132
Mohammed Muneer Avatar answered Sep 19 '22 15:09

Mohammed Muneer