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 created issue -

          From jenkins point of view there is no difference between a user email and a group email so if only some emails get through its your mail server

          This is usually caused by mail being hosted on exchange and the email group has only allow authenticated users ticked (which is the default)

          David van Laatum added a comment - From jenkins point of view there is no difference between a user email and a group email so if only some emails get through its your mail server This is usually caused by mail being hosted on exchange and the email group has only allow authenticated users ticked (which is the default)
          David van Laatum made changes -
          Resolution New: Not A Defect [ 7 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]

          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 made changes -
          Resolution Original: Not A Defect [ 7 ]
          Status Original: Closed [ 6 ] New: Reopened [ 4 ]

          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

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

              Created:
              Updated:
              Resolved: