WordPress.org

Support

Support » How-To and Troubleshooting » How does WP send the user registration email?

How does WP send the user registration email?

  • WP isn’t sending emails (although it says it is) when I create test users to inform them of the password. My mailbox is empty but WP doesn’t complain about not being able to send it. As my box has the minimum services running, is there a requirement for WP to use sendmail or exim or does it handle contacting the remote smpt server itself?

    Please help!

    Thanks.

Viewing 15 replies - 1 through 15 (of 57 total)
  • Having the same problem. I’m not sure how WP is getting logon info for any mail server etc to send an email. The problem may also be that my hosting company, although providing me with my own domain http://www.mydomain.com web address it does not for e-mail servers, my e-mail server is mail.hostingcompany.com 🙁

    WordPress uses the mail function built in php itself. So it does pretty much nothing except relying on underlying system. It does not do any authentication.

    This also means that your hosting provider must have the sendmail function in php activated; it is possible that they closed that.

    Another possibility is that your isp blocks mails from domains where e-mail has a different domain, to prevent spam.

    I’m having the same problem. My notifications on comments posts are being sent (same domain to same domain), but user registration doesn’t produce any email even when I sign a test user up with a valid email address on the same domain.

    Are you sure WP is supposed to email this?

    Is there a config file for hostname, username, password, etc?

    Since I am running this on my own box, how can I confirm it works? I have looked and don’t see any hits on my firewall so that isn’t blocking it. WP says it sends it, I don’t see any traffic or any entries in the message or syslog about errors. Where is it going? Help!

    The php mail function uses sendmail on the host machine. No account information is needed. The first thing you need to know is if you’re using a winblows machine or a *nix machine. If you’re using *nix, you should be ready to go. For Winblows, you may need a sendmail emulator, like http://glob.com.au/sendmail/

    Also, create a phpinfo() page and check that the path to sendmail is correct.

    To check to see if it is functioning correctly, log out and register yourself with an email address on the same machine. Then, log out and register yourself with an email address on a different machine. No emails? Something else is wrong. Of course, someone else at mydomain.com has the same issue: http://forum.mydomain.com/viewtopic.php?t=5440&highlight=php+mail

    If you find that it really doesn’t work, it could be that the admins of the server have blocked mail() from working. If that’s the case, I found a replacement function for it, and have it at http://www.netfobs.org/n_mail.phps . You’ll need to copy it and add the function to the end of wp-includes/functions-compat.php. Change the From email address on line 6. Open wp-includes/functions.php and look for @mail on or about line 1610. Change @mail to @n_mail. Because of the way they work, n_mail() isn’t quite as robust as the mail() function and some of the headers might not make it through.

    I haven’t tried this because my sendmail works correctly (and my host is 5 cents more per month). Your mileage may vary. Back up your files before you make any changes. I’m not going to be held responsible if you break something.

    I’m in the same situation as upt1me however I’m sending update notification to a seperate domain and it also works fine. Regarding the last post why would the mail() issue not effect the posting notifications?

    First, you may be running into this bug. Try this fix and see if that helps.

    Some hosts block outgoing emails that don’t contain an email address that exists on that host in the From: and/or To: fields. This situation is described in this bug. Comment posts going back to a valid username on your domain would work because they have a To: field that is valid for your host. Registration notifications going to another host will have neither a valid From: nor a valid To: field and your host won’t send the email.

    Below is a possible fix for the registration notifications. I puts the admin email address in the From: field. This assumes that the admin email address is a valid username on the machine hosting your wordpress installation.

    --- wp-includes/functions.php (revision 2386)
    +++ wp-includes/functions.php (working copy)
    @@ -1598,6 +1598,7 @@
    function wp_mail($to, $subject, $message, $headers = '') {
    if( $headers == '' ) {
    $headers = "MIME-Version: 1.0n" .
    + "From: " . get_settings('admin_email') . "n";
    "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"n";
    }

    So, find the wp_mail() function in functions.php and add that from line to $headers.

    The forum munged the patch a bit. You can get it here.

    This is wierd, I have tried the @n_mail function and then changed back to the defaults and tried the changes in .diff above and still no dice. This is a box I have here under my own control. I don’t see any traffic going out but WP is still saying the use registration was sent.

    I got user registration working had to adapt the functions.php to work within the constraints of my webhost:

    http://mosquito.wordpress.org/view.php?id=980

    I think i’m having this same problem.
    At first i thought it was just Ryan’s WP-Comment Form plugin (http://wordpress.org/support/topic.php?id=22318) that wasn’t working…but after finding this thread, i tested the WP emailing features, and they too don’t work.

    I tried the 2 techniques here. Tahongawaka’s hack on @n_mail and the patched functions.php…neither work for me. I know the admin email from phpinfo() and tried changing that too.

    Any other suggestions? or if not, what questions should i submit to my host?
    Thanks.

    Let’s see if answering a few different questions will help. Which MTA are you using, is it working, and what does grep apache /var/log/mail.log reply? [change apache to whatever user your web server is running as, and set the path for the mail log correctly] Can you send other email from php?

    Basically, we need to figure out if this is a problem with WordPress, php or your MTA.

    Thanks for the response Tahongawaka.
    I’m going to need a little more guidance on your requests.

    I can tell you according to phpinfo() my MTA is sendmail (path is: /usr/sbin/sendmail -t -i).
    Server info is: Apache/1.3.33 (Unix) PHP/4.3.10 mod_ssl/2.8.22 OpenSSL/0.9.7a FrontPage/5.0.2.2635 mod_throttle/3.1.2
    I don’t have command line access to my server so is there a way to run the grep command using a php script or something?
    Is there a way to test if i can send email using php other than using WP?

    I know that i used to get email notifications in WP1.2 (i remember the volume of spam i once got). However, i turned that off, and only just turned it back on with the upgrade to 1.5.
    FYI…i have rolled back the changes mentioned above to ‘standard’ 1.5 configuration as they provided no change. I can re-implement them if that is required to troubleshoot.
    Thanks for your help.

Viewing 15 replies - 1 through 15 (of 57 total)
  • The topic ‘How does WP send the user registration email?’ is closed to new replies.