Mahmoud ElMansy: knowledge meant to be free

WordPress With External SMTP Server

Using WordPress With External SMTP Server
If you are hosting WordPress on your Own site outside the WordPress hosting you may get “error sending mails” error and this because WordPress works with default settings that you must change
we will change configuration in two files
1- pluggable
the path to the file
In /wp-includes/pluggable.php around line 377, change

Default value

    $phpmailer->isMail();

Change it to

    $phpmailer->isSMTP();

2- class-phpmailer
the path to the file
/wp-includes/class-phpmailer.php around line 155, set your SMTP host:

Default value

  var $Host        ='';

Change it to

    var $Host        = "my.smtphost.com";

You may also need to set a user name and password, and tell WP to attempt authentication. You’ll see those in the lines below the hostname variable.

    var $SMTPAuth     = true;
    var $Username     = "username";
    var $Password     = "password";

On the other hand, you could do this via plugins .