Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to use wp_mail (testing on local machine) but no mail is received. The php.ini has smtp_port = 25 set and the php mail() is working so far.

  • how can I check if wp_mail is working
  • what can fail

Here is the code of my mail function:

function mv_optin_mail($id, $data){

    $url = $id."-".mv_mail_token($id, $data['token']);

    add_filter( 'wp_mail_content_type', 'set_html_content_type' );
    add_filter( 'wp_mail_charset', 'utf8' );

    $headers[] = 'From: '.sender_signature.' <'.noreply_address.'>';    

    $html_mail = ob_get_contents();

    wp_mail( $data['email'], 'Some Subject', $html_mail, $headers );
    remove_filter( 'wp_mail_content_type', 'set_html_content_type' );
    remove_filter( 'wp_mail_charset', 'utf8' );

I don't get any errors. Is there a way to toggle error-loggin for wordpress?

The noreply_address is noreply@root

share|improve this question
Now the remaining questions are: What is mv_mail_token() and what does it return and where does the constant sender_signature come from and what does it contain? –  kaiser Jun 23 '13 at 18:01
Kaiser, listen, please try to answer the questions ... wp_mail_token() returns a string and sender_signature does at well. –  helle Jun 24 '13 at 8:38
debug gist –  kaiser Jun 24 '13 at 9:02

1 Answer 1

I would start by enabling WP_DEBUG in wp-config and see if that shows you anything about your code or the code for the wp_mail function. That is about it for debugging right out of the box with WP.

Also, you can use Easy WP SMTP and enable debugging and/or set that up to use SMTP. There are similar plugins on but I know this one has a good debug option. If something like GMail works then you'll know it is a server setting and not this code.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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