Title: Authentication error
Last modified: September 21, 2021

---

# Authentication error

 *  Resolved [useStrict](https://wordpress.org/support/users/usestrict/)
 * (@usestrict)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/authentication-error-19/)
 * Hi,
 * I’m trying to set up WP Mail SMTP with a new SMTP server and keep getting authentication
   failure. I contacted the sysadmin and he said the following:
 * > It is trying to use CRAM authentication, which won’t work. You need to use 
   > either PLAIN or LOGIN.
 * Is there a way to set the type of authentication? Here is the full error log:
 *     ```
       Versions:
       WordPress: 5.8.1
       WordPress MS: No
       PHP: 7.4.23
       WP Mail SMTP: 3.0.3
   
       Params:
       Mailer: smtp
       Constants: No
       ErrorInfo: SMTP Error: Could not authenticate.
       Host: ***ipp.com
       Port: 587
       SMTPSecure: tls
       SMTPAutoTLS: bool(true)
       SMTPAuth: bool(true)
   
       Server:
       OpenSSL: OpenSSL 1.1.0l  10 Sep 2019
   
       Debug:
       Email Source: WP Mail SMTP
       Mailer: Other SMTP
       SMTP Error: Could not authenticate.
   
       SMTP Debug:
   
       2021-09-21 15:45:45 Connection: opening to ***ipp.com:587, timeout=300, options=array()
   
       2021-09-21 15:45:46 Connection: opened
   
       2021-09-21 15:45:46 SERVER -> CLIENT: 220 allegro.isipp.com ESMTP Sendmail 8.15.2/8.15.2/Debian-8+deb9u1; Tue, 21 Sep 2021 15:45:46 GMT; (No UCE/UBE) logging access from: [x.x.x.x](FORGED)-x.x.x.x.vultr.com [x.x.x.x.x] (may be forged)
   
       2021-09-21 15:45:46 CLIENT -> SERVER: EHLO ***.com
   
       2021-09-21 15:45:46 SERVER -> CLIENT: 250-***ipp.com Hello 216.128.149.225.vultr.com [216.128.149.225] (may be forged), pleased to meet you250-ENHANCEDSTATUSCODES250-PIPELINING250-EXPN250-VERB250-8BITMIME250-SIZE250-DSN250-AUTH DIGEST-MD5 CRAM-MD5250-STARTTLS250-DELIVERBY250 HELP
   
       2021-09-21 15:45:46 CLIENT -> SERVER: STARTTLS
   
       2021-09-21 15:45:46 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
   
       2021-09-21 15:45:46 CLIENT -> SERVER: EHLO ***.com
   
       2021-09-21 15:45:46 SERVER -> CLIENT: 250-***ipp.com Hello x.x.x.x.vultr.com [216.128.149.225] (may be forged), pleased to meet you250-ENHANCEDSTATUSCODES250-PIPELINING250-EXPN250-VERB250-8BITMIME250-SIZE250-DSN250-AUTH DIGEST-MD5 CRAM-MD5 LOGIN PLAIN250-DELIVERBY250 HELP
   
       2021-09-21 15:45:46 CLIENT -> SERVER: AUTH CRAM-MD5
   
       2021-09-21 15:45:46 SERVER -> CLIENT: 334 PDE1NTg5NDg4NDcuNDg0OTI5MUBhbGxlZ3JvLmlzaXBwLmNvbT4=
   
       2021-09-21 15:45:46 CLIENT -> SERVER: [credentials hidden]
   
       2021-09-21 15:45:46 SERVER -> CLIENT: 535 5.7.0 authentication failed
   
       2021-09-21 15:45:46 SMTP ERROR: Username command failed: 535 5.7.0 authentication failed
   
       SMTP Error: Could not authenticate.
   
       2021-09-21 15:45:46 CLIENT -> SERVER: QUIT
   
       2021-09-21 15:45:46 SERVER -> CLIENT: 221 2.0.0 ***ipp.com closing connection
   
       2021-09-21 15:45:46 Connection: closed
   
       SMTP Error: Could not authenticate.
       ```
   
 * Cheers,
    Vinny

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [useStrict](https://wordpress.org/support/users/usestrict/)
 * (@usestrict)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/authentication-error-19/#post-14898109)
 * I found a solution:
 *     ```
       add_filter( 'wp_mail_smtp_custom_options', function( $phpmailer ) {
           $phpmailer->AuthType = 'LOGIN';
   
           return $phpmailer;
       } );
       ```
   
 * It’d be nice if there were a simpler way to test that, or if the plugin could
   cycle through the options when something fails.
 *  [tico87](https://wordpress.org/support/users/tico87/)
 * (@tico87)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/authentication-error-19/#post-14910994)
 * >     ```
   >     I found a solution:
   > 
   >     add_filter( 'wp_mail_smtp_custom_options', function( $phpmailer ) {
   >         $phpmailer->AuthType = 'LOGIN';
   > 
   >         return $phpmailer;
   >     } );
   >     ```
   > 
 * Where to put this line?
    -  This reply was modified 4 years, 8 months ago by [tico87](https://wordpress.org/support/users/tico87/).
 *  [tico87](https://wordpress.org/support/users/tico87/)
 * (@tico87)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/authentication-error-19/#post-14910995)
 * [@usestrict](https://wordpress.org/support/users/usestrict/)
    Where to put this
   line?
 *  [Sanjeev Aryal](https://wordpress.org/support/users/sanzeeb3/)
 * (@sanzeeb3)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/authentication-error-19/#post-14919576)
 * Hi [@tico87](https://wordpress.org/support/users/tico87/),
 * You can check out the documentation on ways to [add custom code snippets](https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/)
   in your site.
 * However, it is probably not the same error you’re getting. If that does not fix
   the issue, please [create a new support post](https://wordpress.org/support/plugin/wp-mail-smtp/#new-topic-0)
   with the SMTP error.
 * [@usestrict](https://wordpress.org/support/users/usestrict/) – WordPress (PHPMailer)
   uses these auth types in order:
 * CRAM-MD5, LOGIN, PLAIN, XOAUTH2
 * But if the receiving SMTP server is not configured correctly, it will fail at
   the first one.
 * I hope this clarifies!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Authentication error’ is closed to new replies.

 * ![](https://ps.w.org/wp-mail-smtp/assets/icon-256x256.png?rev=1755440)
 * [WP Mail SMTP by WPForms - The Most Popular SMTP and Email Log Plugin](https://wordpress.org/plugins/wp-mail-smtp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-mail-smtp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-mail-smtp/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-mail-smtp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-mail-smtp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-mail-smtp/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [Sanjeev Aryal](https://wordpress.org/support/users/sanzeeb3/)
 * Last activity: [4 years, 8 months ago](https://wordpress.org/support/topic/authentication-error-19/#post-14919576)
 * Status: resolved