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

Mail accounts with blank but non-null SMTP usernames erroneously fail validation

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • email-ext-plugin
    • Jenkins 2.249.2
      Email-Ext 2.78
    • 2.79

      Sending mails stopped working after upgrading from 2.76 to 2.78. The only messages I got were:

      [Pipeline] emailext
      21:28:39 Could not create session
      21:28:39 Could not create MimeMessage
      {{[Pipeline] }}}

      I now downgraded to 2.76 to make our intrastructure working again.

          [JENKINS-64095] Mail accounts with blank but non-null SMTP usernames erroneously fail validation

          Manuel Leonhardt created issue -
          Manuel Leonhardt made changes -
          Description Original: Sending mails stopped working after upgrading from 2.76 to 2.78. The only messages I got were:
          [Pipeline] emailext*21:28:39* Could not create session*21:28:39* Could not create MimeMessage[Pipeline]
          I now downgraded to 2.76 to make our intrastructure working again.
          New: Sending mails stopped working after upgrading from 2.76 to 2.78. The only messages I got were:
          [Pipeline] emailext*21:28:39* Could not create session*21:28:39* Could not create MimeMessage[Pipeline] }
          I now downgraded to 2.76 to make our intrastructure working again.
          Manuel Leonhardt made changes -
          Description Original: Sending mails stopped working after upgrading from 2.76 to 2.78. The only messages I got were:
          [Pipeline] emailext*21:28:39* Could not create session*21:28:39* Could not create MimeMessage[Pipeline] }
          I now downgraded to 2.76 to make our intrastructure working again.
          New: Sending mails stopped working after upgrading from 2.76 to 2.78. The only messages I got were:

          {{[Pipeline] emailext}}
          {{21:28:39 Could not create session}}
          {{21:28:39 Could not create MimeMessage}}
          {{[Pipeline] }}}

          I now downgraded to 2.76 to make our intrastructure working again.

          Basil Crow added a comment - - edited
          1. Please provide the Pipeline code you are using to invoke the emailext step.
          2. Please provide a sanitized version of the <mailAccount/> and <addAccounts/> sections of ${JENKINS_HOME}/hudson.plugins.emailext.ExtendedEmailPublisher.xml (e.g., remove actual server names, usernames, passwords).
          3. Please provide a build log with debug mode enabled. Go to Manage Jenkins, click on Configure System, and in the Extended E-mail Notification section check Enable Debug Mode to enable debug mode for the Email Extension plugin. This will add additional log output to the build log for debugging purposes. Please remember to sanitize the build log before posting it here (e.g., remove actual email addresses, etc).
          4. While you're in the Configure System page, please verify that in the Jenkins Location section the System Admin e-mail address is set to a valid address and that the Admin Account Address is set to a valid address for each account in the Additional accounts subsection of the Extended E-mail Notification section (if any additional accounts are present).
          5. Please verify that for the default account and each account in the Additional accounts subsection of the Extended E-mail Notification section (if any additional accounts are present) that an SMTP server is set. Please also verify that the SMTP username is either blank or non-blank and accompanied by an SMTP Password.

          Basil Crow added a comment - - edited Please provide the Pipeline code you are using to invoke the emailext step. Please provide a sanitized version of the <mailAccount/> and <addAccounts/> sections of ${JENKINS_HOME}/hudson.plugins.emailext.ExtendedEmailPublisher.xml (e.g., remove actual server names, usernames, passwords). Please provide a build log with debug mode enabled. Go to Manage Jenkins, click on Configure System, and in the  Extended E-mail Notification section check Enable Debug Mode to enable debug mode for the Email Extension plugin. This will add additional log output to the build log for debugging purposes. Please remember to sanitize the build log before posting it here (e.g., remove actual email addresses, etc). While you're in the Configure System page, please verify that in the Jenkins Location section the System Admin e-mail address is set to a valid address and that the Admin Account Address is set to a valid address for each account in the Additional accounts subsection of the Extended E-mail Notification section (if any additional accounts are present). Please verify that for the default account and each account in the Additional accounts subsection of the Extended E-mail Notification section (if any additional accounts are present) that an SMTP server is set. Please also verify that the SMTP username is either blank or non-blank and accompanied by an SMTP Password .
          Basil Crow made changes -
          Assignee New: Basil Crow [ basil ]

          Basil Crow added a comment -

          This was almost certainly caused by jenkinsci/email-ext-plugin#217. To fix this I will almost certainly need what I requested in #2 above; namely, a sanitized version of the <mailAccount/> and <addAccounts/> sections of ${JENKINS_HOME}/hudson.plugins.emailext.ExtendedEmailPublisher.xml on a system that is exhibiting the problem. Please make sure the system is exhibiting the problem at the time you collect and send me ${JENKINS_HOME}/hudson.plugins.emailext.ExtendedEmailPublisher.xml in order to facilitate proper diagnosis. It would also be helpful to know if you are using the default account or an additional account and what (if anything) you are passing in as the from parameter to the emailext step. One possible cause of the problem might be if smtpUsername is blank rather than unset (i.e., <smtpUsername></smtpUsername> appears rather than no entry existing in ${JENKINS_HOME}/hudson.plugins.emailext.ExtendedEmailPublisher.xml). The relevant validation logic:

              public boolean isValid() {
                  return (isDefaultAccount() || StringUtils.isNotBlank(address)) && StringUtils.isNotBlank(smtpHost) && (!isAuth() || (StringUtils.isNotBlank(smtpUsername) && smtpPassword != null));
              }
          […]
              public boolean isAuth(){
                  return smtpUsername != null;
              }
          

          Basil Crow added a comment - This was almost certainly caused by jenkinsci/email-ext-plugin#217 . To fix this I will almost certainly need what I requested in #2 above; namely, a sanitized version of the <mailAccount/> and <addAccounts/> sections of ${JENKINS_HOME}/hudson.plugins.emailext.ExtendedEmailPublisher.xml on a system that is exhibiting the problem. Please make sure the system is exhibiting the problem at the time you collect and send me ${JENKINS_HOME}/hudson.plugins.emailext.ExtendedEmailPublisher.xml in order to facilitate proper diagnosis. It would also be helpful to know if you are using the default account or an additional account and what (if anything) you are passing in as the from parameter to the emailext step. One possible cause of the problem might be if smtpUsername is blank rather than unset (i.e., <smtpUsername></smtpUsername> appears rather than no entry existing in ${JENKINS_HOME}/hudson.plugins.emailext.ExtendedEmailPublisher.xml ). The relevant validation logic: public boolean isValid() { return (isDefaultAccount() || StringUtils.isNotBlank(address)) && StringUtils.isNotBlank(smtpHost) && (!isAuth() || (StringUtils.isNotBlank(smtpUsername) && smtpPassword != null )); } […] public boolean isAuth(){ return smtpUsername != null ; }

          Basil Crow added a comment -

          I opened jenkinsci/email-ext-plugin#258 to clean up the smtpUsername null check and add additional logging when Enable Debug Mode is enabled during mail account selection and mail account validation. Incremental build 2.79-rc1412.69bbd2a4562b is available for testing this change. The incremental build is available from: https://repo.jenkins-ci.org/incrementals/org/jenkins-ci/plugins/email-ext/2.79-rc1412.69bbd2a4562b/ For instructions on how to install a custom build, see: https://www.jenkins.io/doc/book/managing/plugins/#advanced-installation

          Basil Crow added a comment - I opened jenkinsci/email-ext-plugin#258 to clean up the smtpUsername null check and add additional logging when Enable Debug Mode is enabled during mail account selection and mail account validation. Incremental build 2.79-rc1412.69bbd2a4562b is available for testing this change. The incremental build is available from: https://repo.jenkins-ci.org/incrementals/org/jenkins-ci/plugins/email-ext/2.79-rc1412.69bbd2a4562b/ For instructions on how to install a custom build, see: https://www.jenkins.io/doc/book/managing/plugins/#advanced-installation
          Oleg Nenashev made changes -
          Labels New: regression
          Steve Graham made changes -
          Link New: This issue is blocked by JENKINS-64110 [ JENKINS-64110 ]

          Dave Kennedy added a comment -

          Same issue happened to me, i was able to unblock by unsetting the smtpUsername within ${JENKINS_HOME}/hudson.plugins.emailext.ExtendedEmailPublisher.xml

          Dave Kennedy added a comment - Same issue happened to me, i was able to unblock by unsetting the smtpUsername within ${JENKINS_HOME}/hudson.plugins.emailext.ExtendedEmailPublisher.xml

            basil Basil Crow
            skycaptain Manuel Leonhardt
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: