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

Unable to send mail to smtp.office365.com, port 587, using TLS

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reopened (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: mailer-plugin
    • Labels:
      None
    • Environment:
      Windows 7 platform (64 bit). Jenkins version 2.88. Oracle JRE 8.0_151, running Jenkins directly, using Chrome web browser (62.0.3202.89).
      mailer plugin (1.20)
    • Similar Issues:

      Description

      I have scoured the internet for solutions to this particular issue, but none of the suggested solutions solves the problem.  I have also looked at the same issues raised here in the Jenkins Jira.

      The smtp.office365.com site is using TLS on port 587.

      This is what has been attempted to date. In Jenkins System Configuration for E-mail Notification. The MyName@mydomain.com represents a valid user in the mailing system.
      (Invalid user or password results in Authentication error instead of what is reported below)

      1.  User Name:  MyName@mydomain.com
       	Password:   •••••••••••••
       	Use SSL:    Checked
       	SMTP Port:  587
              Test e-mail recipient: MyName@mydomain.com
      
      Results:
          Failed to send out e-mail
          javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
      
      When 'Use SSL' is unchecked, results are
          Failed to send out e-mail
          com.sun.mail.smtp.SMTPSendFailedException: \
              550 5.7.60 SMTP; Client does not have permissions to send as this sender
      
      2. Placing -Dmail.smtp.starttls.enable=true into jenkins.xml then restart Jenkins. 
      
      	User Name:  MyName@mydomain.com
       	Password:   •••••••••••••
       	Use SSL:    Checked  (then unchecked)
       	SMTP Port:  587
              Test e-mail recipient: MyName@mydomain.com
      

      This gives the identical results mentioned in the first testing attempt.
      As mentioned on Stack OverFlow and the Jenkins Jira issues, I have even added the following to jenkins.xml with the same results.

        -Djava.awt.headless=true 
        -Dmail.smtp.starttls.enable=true 
        -Dmail.smtp.socketFactory.fallback=true
      

      Note, on this same machine, I can use a Powershell Send-MailMessage command which succeeds in its intended operation. This at least tells me that the account, port and SSL usage are all appropriate settings. ($mycred holds MyName@mydomain.com and Password)

      Send-MailMessage 
        -to "MyName@mydomain.com" 
        -from "MyName@mydomain.com" 
        -Subject "mailTest" 
        -credential $mycred
        -smtpserver smtp.office365.com 
        -port 587 
        -usessl
      

        Attachments

          Activity

          shaehn Steven Haehn created issue -
          shaehn Steven Haehn made changes -
          Field Original Value New Value
          Description I have scoured the internet for solutions to this particular issue, but none of the suggested solutions solves the problem.  I have also looked at the same issues raised here in the Jenkins Jira.

          The smtp.office365.com site is using SSL on port 587.

          This is what has been attempted to date. In Jenkins System Configuration for E-mail Notification. The MyName@mydomain.com represents a valid user in the mailing system.
           (Invalid user or password results in Authentication error instead of what is reported below)
          {noformat}
          1. User Name: MyName@mydomain.com
            Password: •••••••••••••
            Use SSL: Checked
            SMTP Port: 587
                  Test e-mail recipient: MyName@mydomain.com

          Results:
              Failed to send out e-mail
              javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?

          When 'Use SSL' is unchecked, results are
              Failed to send out e-mail
              com.sun.mail.smtp.SMTPSendFailedException: \
                  550 5.7.60 SMTP; Client does not have permissions to send as this sender

          2. Placing -Dmail.smtp.starttls.enable=true into jenkins.xml then restart Jenkins.

          User Name: MyName@mydomain.com
            Password: •••••••••••••
            Use SSL: Checked (then unchecked)
            SMTP Port: 587
                  Test e-mail recipient: MyName@mydomain.com
          {noformat}
          This gives the identical results mentioned in the first testing attempt.
           As mentioned on Stack OverFlow and the Jenkins Jira issues, I have even added the following to jenkins.xml with the same results.
          {noformat}
            -Djava.awt.headless=true
            -Dmail.smtp.starttls.enable=true
            -Dmail.smtp.socketFactory.fallback=true
          {noformat}
          Note, on this same machine, I can use a Powershell Send-MailMessage command which succeeds in its intended operation. This at least tells me that the account, port and SSL usage are all appropriate settings. ($mycred holds MyName@mydomain.com and Password)
          {code:java}
          Send-MailMessage
            -to "MyName@mydomain.com"
            -from "MyName@mydomain.com"
            -Subject "mailTest"
            -credential $mycred
            -smtpserver smtp.office365.com
            -port 587
            -usessl
          {code}
          I have scoured the internet for solutions to this particular issue, but none of the suggested solutions solves the problem.  I have also looked at the same issues raised here in the Jenkins Jira.

          The smtp.office365.com site is using TLS on port 587.

          This is what has been attempted to date. In Jenkins System Configuration for E-mail Notification. The MyName@mydomain.com represents a valid user in the mailing system.
           (Invalid user or password results in Authentication error instead of what is reported below)
          {noformat}
          1. User Name: MyName@mydomain.com
            Password: •••••••••••••
            Use SSL: Checked
            SMTP Port: 587
                  Test e-mail recipient: MyName@mydomain.com

          Results:
              Failed to send out e-mail
              javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?

          When 'Use SSL' is unchecked, results are
              Failed to send out e-mail
              com.sun.mail.smtp.SMTPSendFailedException: \
                  550 5.7.60 SMTP; Client does not have permissions to send as this sender

          2. Placing -Dmail.smtp.starttls.enable=true into jenkins.xml then restart Jenkins.

          User Name: MyName@mydomain.com
            Password: •••••••••••••
            Use SSL: Checked (then unchecked)
            SMTP Port: 587
                  Test e-mail recipient: MyName@mydomain.com
          {noformat}
          This gives the identical results mentioned in the first testing attempt.
           As mentioned on Stack OverFlow and the Jenkins Jira issues, I have even added the following to jenkins.xml with the same results.
          {noformat}
            -Djava.awt.headless=true
            -Dmail.smtp.starttls.enable=true
            -Dmail.smtp.socketFactory.fallback=true
          {noformat}
          Note, on this same machine, I can use a Powershell Send-MailMessage command which succeeds in its intended operation. This at least tells me that the account, port and SSL usage are all appropriate settings. ($mycred holds MyName@mydomain.com and Password)
          {code:java}
          Send-MailMessage
            -to "MyName@mydomain.com"
            -from "MyName@mydomain.com"
            -Subject "mailTest"
            -credential $mycred
            -smtpserver smtp.office365.com
            -port 587
            -usessl
          {code}
          shaehn Steven Haehn made changes -
          Attachment Jenkins SMTP mail settings.png [ 40294 ]
          Attachment jenkins.xml settings for TLS.png [ 40295 ]
          shaehn Steven Haehn made changes -
          Assignee Steven Haehn [ shaehn ]
          Resolution Not A Defect [ 7 ]
          Status Open [ 1 ] Resolved [ 5 ]
          shaehn Steven Haehn made changes -
          Summary Unable to send mail to smtp.office365.com, port 587, using SSL Unable to send mail to smtp.office365.com, port 587, using TLS
          rakesh_perfengineer Rakesh S made changes -
          Resolution Not A Defect [ 7 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          rakesh_perfengineer Rakesh S made changes -
          Attachment jenkinsError.png [ 51084 ]
          rakesh_perfengineer Rakesh S made changes -
          Attachment jenkinsError2.JPG [ 51085 ]
          patrickleveille Patrick Leveille made changes -
          Attachment image-2020-06-16-14-38-55-371.png [ 51650 ]
          patrickleveille Patrick Leveille made changes -
          Attachment image-2020-06-16-14-41-29-876.png [ 51651 ]

            People

            Assignee:
            shaehn Steven Haehn
            Reporter:
            shaehn Steven Haehn
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated: