0

Currently I have two WooCommerce setups both running on the same server for demonstration and testing purposes. Each is installed on a different subdomain. One sends out registration and forgot password emails ("working" version) but the other does not ("fail" version). Both use WP latest (3.8).

The "working" version is running 100% default everything and the Twenty Twelve theme with WooCommerce dummy data imported.

The "fail" version is running a custom theme and several plugins (various WooCommerce payment gateways, Advanced Custom Fields, and a Mailchimp plugin). When I change the theme to Twenty Twelve and delete ALL plugins except those running on the "working" version I still cannot get any registration or lost password emails to send. Tested with multiple email addresses.

Any help troubleshooting would be greatly appreciated!


Update

After following @Subharanjan's advice here are the relevant entries in my mail.txt log:

array (
     'error_count' => 1,
     'sign_cert_file' => '',
     'sign_key_file' => '',
     'sign_key_pass' => '',
     'exceptions' => true,
)
  • 1
    have you checked you error logs? – Mark Kaplun Dec 30 '13 at 14:58
  • Yes, "working" doesn't trigger any errors but "fail" triggers Account has exceeded the max emails per hour allowed and sendmail: command not found errors. Strange because they're both on the same server. Will call my host about this. – cfx Dec 30 '13 at 15:06
  • 1
    Yes, if you have this error, try contacting the host provider. – Subharanjan Dec 30 '13 at 15:08
  • My guess is that the email server checks the originating address, but yes, unless you have root access to the email server this is something that needs to be handled by your host. – s_ha_dum Dec 30 '13 at 15:16
1

-- Check your log files for any errors if you have one.

else

-- Create a file say 'wp-mail-log.txt' inside your theme folder for temporary period and paste these below code inside theme's functions.php file to log email issues/status of email fired etc into the log file created. Then you can troubleshoot easily. It will write to the log file each time a email has been fired !!

add_filter( 'wp_mail', 'log_wp_mail', 1 );
add_filter( 'phpmailer_init', 'log_wp_mail', 1 );
function log_wp_mail( $args ) {
    try {
        $log_message = "\n----------MARK-------------\n" . var_export(
                array(
                    'date' => date( 'r' ),
                    'args' => $args
                ), true
            );
        // Now write the log message somewhere, for example:
        $fp = fopen( dirname( __FILE__ ) . '/wp-mail-log.txt', 'a+' );
        fwrite( $fp, $log_message );
        fclose( $fp );
    } catch ( Exception $e ) {
    }

    return $args;
}
|improve this answer|||||
  • 1
    Did that, check my update in the OP. Great little function btw! – cfx Dec 30 '13 at 15:22
  • Yeah... I saw that after pasted the code here !! Just some seconds of delay. – Subharanjan Dec 30 '13 at 15:31
0

I just completed troubleshooting with my hosting support and there was an error (not sure where yet, CSR should be sending it shortly) but it was not viewable by me anywhere in my cPanel.

The error message led me to suspect that my 77 character long site name was a problem. I went into WooCommerce->Settings->Emails and changed the "From" Name to "Test" and everything worked instantly. Go figure.

I would think that an issue like this would not be enough to completely kill a mail daemon, shouldn't the string be truncated?

Anyhow, thanks to everyone who chimed in!


Edit

After more testing it turns out it wasn't the length; WooCommerce pulls in the default data for that field from Settings->General->Site Title. My Site Title had an em dash (the character or —) in it, which caused the problem.


Edit 2

This is now reported to WooCommerce as Issue #4435

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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