0

When a user registers on my wordpress site, it does not send them an email containing the password.

I do notice that an email was sent when a users email is @mydomain.com, but for others let say gmail.com or yahoo.com, it does not send an email.

How do I fix it?

6
  • I'm not sure what your using as your backend (eg: cpanel). But can you send an email from your server to gmail.com or yahoo.com email address? Also are you saying that when the user uses your domain name, then the email is sent?
    – Vincent P
    Commented Jan 29, 2013 at 10:30
  • im using cpanel. I can send in webmail to gmail.com email address. Yes, the email was sent when a user from my domain name.
    – JR Galia
    Commented Jan 29, 2013 at 10:37
  • the problem is on wordpress. :-(
    – JR Galia
    Commented Jan 29, 2013 at 10:38
  • Does the reset password send emails? Is there anything in your log file?
    – Tom J Nowell
    Commented Jan 29, 2013 at 10:40
  • reset password only work for email with mydomain, for other's like gmail.com or yahoo.com, it wont.
    – JR Galia
    Commented Jan 29, 2013 at 10:42

1 Answer 1

2

While not a solution as such, I would suggest you send a couple of test emails to isolate the issue and verify how and where things go wrong. Perhaps your email is actually sent, but rejected by the remote mail server due to missing some headers etc. The code below might help you determine this. Temporarily put it in functions.php. wp_mail will return true on success and false otherwise.

function email_test() {
    $test1 = wp_mail( [email protected], "Test 1", "Just testing" );
    $test2 = wp_mail( [email protected], "Test 2", "Just testing some more" );

    var_dump($test1);
    var_dump($test2);
    var_dump(ini_get('smtp_port'));

    die();
}
add_action('plugins_loaded', 'email_test');

There are a few SMTP related PHP settings which might influence the behavior of mail() and in turn wp_mail(). If you are using shared hosting I would suggest you simply describe the problem to you hosting provider and have them adjust the settings, or hopefully they'll be able at least to point you in the right direction.

I have also seen some issues with email being sent, but rejected by the remote server due to missing headers. While wp_mail should take care of most of these, adding headers like From, Reply-To, Return-Path, Organization, X-PHP-Script might sometimes help (check out the fourth argument for wp_mail).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.