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

emailext takes incorrect SMTP username pwd values

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: Minor Minor
    • None

      (Apologies if provided information is not sufficient enough. This is my first time setting-up / using jenkins)

      1. Have configured mailer, email, and email extension plugins to use my gmail smtp
      2. Jenkins Pipeline built to send email notification as a post- step
      3. Test smtp email from jenkins successful { smtp.google.com, my username, my 2fa app pwd, SSL, port:587 }
      4. Emailext plug-in's SMTP settings match ones created in step 3
      5. Post- build email fails w/ following:

       

      Adding recipients from trigger recipient list

      Successfully created MimeMessage 

      Sending email to: << redacted >>

      DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle] 

      DEBUG SMTP: need username and password for authentication 

      DEBUG SMTP: protocolConnect returning false, host=smtp.google.com, user=jenkins_adm, password=<null> 

      DEBUG SMTP: useEhlo true, useAuth true DEBUG SMTP: trying to connect to host "smtp.google.com", port 587, isSSL false

       

      Few other things I've tried:

      a. when emailext plugin SMTP settings are set to some invalid values e.g. smtp server = lalaland, port = 25, user = dumbo, password = dumbo; pipeline build shows same error as above, in the console log

      b. when email plugin SMTP settings are erased, logs indicate below mentioned, and it assumes user=jenkins_adm (my jenkins admin acct). Log shows same issue as above:

      DEBUG SMTP: need username and password for authentication 

      DEBUG SMTP: protocolConnect returning false, host=smtp.google.com, user=jenkins_adm, password=<null> 

      DEBUG SMTP: useEhlo true, useAuth true DEBUG SMTP: trying to connect to host "smtp.google.com", port 587, isSSL false

       c. tried turning SSL on, TLS off; same result. it doesn't take the username/pwd from emailext or mailer plugin's .xml file

       

      Happy to provide further logs / information.

          [JENKINS-66532] emailext takes incorrect SMTP username pwd values

          Maulik added a comment - - edited

          Additional information which may be helpful:

          1. Pipeline code invoking emailext
                post {
                always {
                    emailext body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}",
                        to: '$DEFAULT_RECIPIENTS',
                        subject: "Jenkins Build ${currentBuild.currentResult}: Job ${env.JOB_NAME}"
                    
                    }
                } 
            
          1. hudson.plugins.emailext.ExtendedEmailPublisher.xml snippet:

           

            <mailAccount>
              <smtpHost>smtp.google.com</smtpHost>
              <smtpPort>587</smtpPort>
              <smtpUsername>some_value</smtpUsername>
              <smtpPassword>some_value</smtpPassword>
              <useSsl>false</useSsl>
              <useTls>true</useTls>
              <advProperties></advProperties>
              <defaultAccount>true</defaultAccount>
            </mailAccount>
            <addAccounts>
              <hudson.plugins.emailext.MailAccount>
                <address>some_value</address>
                <smtpHost>smtp.google.com</smtpHost>
                <smtpPort>587</smtpPort>
                <smtpUsername>some_value</smtpUsername>
                <smtpPassword>some_value</smtpPassword>
                <useSsl>false</useSsl>
                <useTls>true</useTls>
                <advProperties></advProperties>
                <defaultAccount>false</defaultAccount>
              </hudson.plugins.emailext.MailAccount>
            </addAccounts>
          

          Maulik added a comment - - edited Additional information which may be helpful: Pipeline code invoking emailext post { always { emailext body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}" , to: '$DEFAULT_RECIPIENTS' , subject: "Jenkins Build ${currentBuild.currentResult}: Job ${env.JOB_NAME}" } } hudson.plugins.emailext.ExtendedEmailPublisher.xml snippet:      <mailAccount>      <smtpHost> smtp.google.com </smtpHost>      <smtpPort> 587 </smtpPort>      <smtpUsername> some_value </smtpUsername>      <smtpPassword> some_value </smtpPassword>      <useSsl> false </useSsl>      <useTls> true </useTls>      <advProperties> </advProperties>      <defaultAccount> true </defaultAccount>    </mailAccount>    <addAccounts>      <hudson.plugins.emailext.MailAccount>        <address> some_value </address>        <smtpHost> smtp.google.com </smtpHost>        <smtpPort> 587 </smtpPort>        <smtpUsername> some_value </smtpUsername>        <smtpPassword> some_value </smtpPassword>        <useSsl> false </useSsl>        <useTls> true </useTls>        <advProperties> </advProperties>        <defaultAccount> false </defaultAccount>      </hudson.plugins.emailext.MailAccount>    </addAccounts>

          Alex Earl added a comment -

          I think you need to use smtp.gmail.com and port 465 with SSL. This is my setup:

           
          <smtpHost>smtp.gmail.com</smtpHost>
          <smtpPort>465</smtpPort>
          <useSsl>true</useSsl>
          <useTls>false</useTls>

          Alex Earl added a comment - I think you need to use smtp.gmail.com and port 465 with SSL. This is my setup:   <smtpHost>smtp.gmail.com</smtpHost> <smtpPort>465</smtpPort> <useSsl>true</useSsl> <useTls>false</useTls>

          Alex Earl added a comment -

          No user input after last response.

          Alex Earl added a comment - No user input after last response.

            Unassigned Unassigned
            maulikvaidya Maulik
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: