Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-54617

email-ext-plugin in Pipeline does not send email to group email id

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Critical Critical
    • email-ext-plugin
    • None
    • Jenkins ver. 2.107.2 (installed on centos 7)
      email-ext plugin 2.62

      1. email-ext-plugin in Pipeline script does not send email to group email id even though console says sending email. The same works for individual email id.

      [Pipeline] emailextSending email to: groupEmail@BMC.com

      1. Also "cc:" & "bcc:" doesn't work at all from pipeline script, no matter how I try it. Any example of using CC, BCC will be really helpful.
        def notifyTest() {
         emailext (
         subject: "Test Email Ignore",
         body: """Hello All,
        
        JenkinsAdmin""",
         to: "groupEmailID@bmc.com",
         cc:'spatne@bmc.com',
         bcc:'swapnil_patne@bmc.com',
         from: "JenkinsAdmin@IS-Automation.bmc.com"
         )
         }

          [JENKINS-54617] email-ext-plugin in Pipeline does not send email to group email id

          Swapnil Patne added a comment -

          I can send email to same email group from jenkins server through linux 'mail" command. So that's not an issue. Also any comment on usage of CC/BCC will be helpful.

          Swapnil Patne added a comment - I can send email to same email group from jenkins server through linux 'mail" command. So that's not an issue. Also any comment on usage of CC/BCC will be helpful.

          Are you using the local mail server in jenkins? If so does the email show up in the logs?

          David van Laatum added a comment - Are you using the local mail server in jenkins? If so does the email show up in the logs?

          Swapnil Patne added a comment -

          I mean, I was doing it from crontab for sending email before starting job through rest API call from shell script. That is working. However this does not give me facility of using env variables to be used in email as I am doing it outside of jenkins. Hence tried email-ext plugin in my pipeline script as the example given above in description.

          Swapnil Patne added a comment - I mean, I was doing it from crontab for sending email before starting job through rest API call from shell script. That is working. However this does not give me facility of using env variables to be used in email as I am doing it outside of jenkins. Hence tried email-ext plugin in my pipeline script as the example given above in description.

          If as you say some email gets through its highly likely not jenkins but something in your setup that is the problem. I get tickets about this all the time and it always ends up being mail server or spam filter or similar dropping the emails. Check the logs on whatever server is configured as the email server in jenkins and I am almost positive you will find entries there saying jenkins sent the email, what happens to it after that is outside of jenkins control

          David van Laatum added a comment - If as you say some email gets through its highly likely not jenkins but something in your setup that is the problem. I get tickets about this all the time and it always ends up being mail server or spam filter or similar dropping the emails. Check the logs on whatever server is configured as the email server in jenkins and I am almost positive you will find entries there saying jenkins sent the email, what happens to it after that is outside of jenkins control

          Swapnil Patne added a comment -

          Not a good question to ask, however I haven't configured any mail server myself, so which logs to check in the server? Jenkins logs or some linux logs? All I know is same pipeline script send me email if I put my email id in "to:".
          Also my crontab code which work looks like below which sends email to same group email id

          40 09 * * 0-5 mail -s 'Automation Run will be started soon' -r JenkinsAdmin@IS-Automation.bmc.com -c manager1@bmc.com,manager2@bmc.com,teamLead1@bmc.com swapnil_patne@bmc.com,someGroupMail@BMC.com < /opt/starting-automation-email.txt
          

          Swapnil Patne added a comment - Not a good question to ask, however I haven't configured any mail server myself, so which logs to check in the server? Jenkins logs or some linux logs? All I know is same pipeline script send me email if I put my email id in "to:". Also my crontab code which work looks like below which sends email to same group email id 40 09 * * 0-5 mail -s 'Automation Run will be started soon' -r JenkinsAdmin@IS-Automation.bmc.com -c manager1@bmc.com,manager2@bmc.com,teamLead1@bmc.com swapnil_patne@bmc.com,someGroupMail@BMC.com < /opt/starting-automation-email.txt

          In jenkins global settings at http://<jenkins-server>/configure there are settings for mail server to use to send email.

          The local mail command used by cron may be configured differently than jenkins hence why it works

          David van Laatum added a comment - In jenkins global settings at http://<jenkins-server>/configure there are settings for mail server to use to send email. The local mail command used by cron may be configured differently than jenkins hence why it works

          Swapnil Patne added a comment -

          ok, that is empty for me(screenshot attached). So I need to first setup SMTP server and then provide those details in the email config section, right? However this is working for individual email id even without setting that SMTP Server field, is it expected behavior?

          Swapnil Patne added a comment - ok, that is empty for me(screenshot attached). So I need to first setup SMTP server and then provide those details in the email config section, right? However this is working for individual email id even without setting that SMTP Server field, is it expected behavior?

          I think it might default to the settings for the default jenkins email plugin falling back to localhost

          David van Laatum added a comment - I think it might default to the settings for the default jenkins email plugin falling back to localhost

          Alex Earl added a comment -

          Can emails be sent to the group email via normal email methods? We have a similar issue at my company that we are looking into. Sending emails via Outlook to the groups works, but sending from Jenkins does not. It would be interesting to know if you are seeing the same thing.

          Alex Earl added a comment - Can emails be sent to the group email via normal email methods? We have a similar issue at my company that we are looking into. Sending emails via Outlook to the groups works, but sending from Jenkins does not. It would be interesting to know if you are seeing the same thing.

          Alex Earl added a comment -

          Need additional details from submitter. Please reopen if you have additional details.

          Alex Earl added a comment - Need additional details from submitter. Please reopen if you have additional details.

            slide_o_mix Alex Earl
            swapnilpatne Swapnil Patne
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: