Jenkins SMTP Email configuration fails verification

Jenkins SMTP Email configuration fails verification

Problem Description:

I am using jenkins and trying to set the Email Configurations to use SMTP but it fails the verification step.
I am running Jenkins on localhost:8080. in Safari. on osx mavericks.

in jenkins under the advanced settings of the email configurations I’ve set them as,

SMTP Server: “”
email suffix: “”

SMTP Authentication: YES
User Name
Use SSL : yes
SMTP Port: 465

I’ve followed the support url that is offered by the error. I’ve already verified that my username and password is correct. I’ve enabled the setting that allows less secure requests to the gmail server.

I honestly do not know what else I can try to make this work.

the error is below.

javax.mail.AuthenticationFailedException: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 cw5sm7815504pbc.9 - gsmtp

    at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(
    at com.sun.mail.smtp.SMTPTransport.authenticate(
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(
    at javax.mail.Service.connect(
    at javax.mail.Service.connect(
    at javax.mail.Service.connect(
    at javax.mail.Transport.send0(
    at javax.mail.Transport.send(
    at hudson.tasks.Mailer$DescriptorImpl.doSendTestMail(
    at sun.reflect.GeneratedMethodAccessor230.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
    at java.lang.reflect.Method.invoke(
    at org.kohsuke.stapler.Function$InstanceFunction.invoke(
    at org.kohsuke.stapler.Function.bindAndInvoke(
    at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(
    at org.kohsuke.stapler.MetaClass$1.doDispatch(
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(
    at org.kohsuke.stapler.Stapler.tryInvoke(
    at org.kohsuke.stapler.Stapler.invoke(
    at org.kohsuke.stapler.MetaClass$6.doDispatch(
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(
    at org.kohsuke.stapler.Stapler.tryInvoke(
    at org.kohsuke.stapler.Stapler.invoke(
    at org.kohsuke.stapler.Stapler.invoke(
    at org.kohsuke.stapler.Stapler.service(
    at javax.servlet.http.HttpServlet.service(
    at org.eclipse.jetty.servlet.ServletHolder.handle(
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
    at hudson.util.PluginServletFilter$1.doFilter(
    at hudson.util.PluginServletFilter.doFilter(
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
    at org.kohsuke.stapler.compression.CompressionFilter.doFilter(
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
    at hudson.util.CharacterEncodingFilter.doFilter(
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(
    at org.eclipse.jetty.servlet.ServletHandler.doScope(
    at org.eclipse.jetty.server.session.SessionHandler.doScope(
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(
    at org.eclipse.jetty.server.Server.handle(
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(
    at org.eclipse.jetty.server.AbstractHttpConnection.content(
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(
    at org.eclipse.jetty.http.HttpParser.parseNext(
    at org.eclipse.jetty.http.HttpParser.parseAvailable(
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(
    at winstone.BoundedExecutorService$
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
    at java.util.concurrent.ThreadPoolExecutor$

Solution – 1

Update mailer plugin to 1.1 in Jenkins.
Update jenkins to latest version.
Restart. Works fine then.
Updating jenkins is optional.

Solution – 2

Please check the settings in your google account.

I set “Access for less secure apps” to allowed when I got the same error.

After that I was able to send mails with the settings you specified.

Solution – 3

In my case, I had to perform an extra step (see point 2 below) to make it work:

  1. Allow less secure app access: click and select
    Turn on
  2. Unlock captcha: click and select continue

Solution – 4

Since May 2022, the less secure app is disabled permanently by Google to secure account. Try the steps below

1–> Google account->Manage your Google Account->Security->Signing into Google->App Password–> for App select "MAIL" and for device select "WINDOWS COMPUTER"
->Generate the App Password.

——-NOTE ——please make sure you write the password as you required to write the same password in Jenkins later

2–> in SMTP Authentication instead of your Gmail password , write the generated App Password (Without any space).

3–> please check the box "Test configuration by sending test e-mail"

4—> Click on Test Configuration.

Rate this post
We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.