TransWikia.com

How can I configure an SMTP Server?

WordPress Development Asked by ellen on February 11, 2021

I’m trying to follow the instructions here: https://gist.github.com/butlerblog/7e4dbafcbc61b15505ee8ca90510f1e7

But I’m getting confused. I’m not sure what arguments to pass where. Here is what I have:

define( 'SMTP_USER',   '[email protected]' );    // The email address I use when I log in to the wp-admin page
define( 'SMTP_PASS',   '123password' );       // The password I use when I log in to the wp-admin page
define( 'SMTP_HOST',   'localhost' );    // I am testing this on localhost
define( 'SMTP_FROM',   '[email protected]' ); // Also the email address I use for logging in on the wp-admin page
define( 'SMTP_NAME',   'My Site Name' );    // SMTP From name
define( 'SMTP_PORT',   '25' );                  // SMTP port number - likely to be 25, 465 or 587
define( 'SMTP_SECURE', 'tls' );                 // Encryption system to use - ssl or tls
define( 'SMTP_AUTH',    true );                 // Use SMTP authentication (true|false)
define( 'SMTP_DEBUG',   1 );                    // for debugging purposes only set to 1 or 2

I am pretty sure I am not sending in the right stuff. When I try to use wp_mail, I get the following error in the debug log:

[0] => SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

Any advice?
Thank you!

One Answer

But based solely on what you posted, the problem is the following:

define( 'SMTP_USER',   '[email protected]' );    // The email address I use when I log in to the wp-admin page
define( 'SMTP_PASS',   '123password' );       // The password I use when I log in to the wp-admin page
define( 'SMTP_HOST',   'localhost' );    // I am testing this on localhost
define( 'SMTP_FROM',   '[email protected]' ); // Also the email address I use for logging in on the wp-admin page

The script you posted is to define the connection information to an SMTP server. Unless you are actually running an SMTP server on your localhost with the login credentials you supplied in the other constant definitions, then that is why your script is failing.

The SMTP_HOST constant must define the location of the SMTP email server you are trying to connect to (such as

Likewise, the login information should not be what you use to login to WordPress. You indicated in your comments that these are the login credentials that you use logging in to wp-admin. But what they should be is the login credentials for the email account on the SMTP server you are connecting to.

If you have an email account you are intend to send through, check with your email provider. They should be able to supply you with the correct connection information.

Answered by butlerblog on February 11, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP