Support » Fixing WordPress » Any recent changes to wp_mail ?

  • Resolved Shmoo


    Did something change to the wp_mail() function in the last few WordPress updates that I somehow missed out on?

    For some reason my simple contact form do not work anymore. No plugin, just hardcoded into a page template by the use of wp_mail().

    $sent = wp_mail( $to, $subject, strip_tags( $output ), $headers );
    if ( $sent ) prefix_contact_form_generate_response( "success", $message_sent );
    else prefix_contact_form_generate_response( "error", $message_unsent );

    I get the ELSE statement above.

    Strange part is. When I test this form locally on my computer by the use of an SMTP plugin it just works and I can send emails via the form, from my localhost > via SMTP mailprovider to my inbox. Testing works fine. Online on the server is doesn’t.

Viewing 2 replies - 1 through 2 (of 2 total)
  • SMTP Error: data not accepted.

    After activating the wp_mail_failed debugging hook I get this error back.

    The only thing I can think of is that maybe my headers aren’t valid because in this error log (picture) it’s an empty Array. The Codex doesn’t mention it must be an array, it says string or array.

    For me it’s just a string. Could this be the problem?

    $headers = 'From: '. $email . "\r\n" . 'Reply-To: ' . $email . "\r\n";

    Got it fixed!

    The headers ‘From: @mail’ had to be the address of the WordPress hosted domain. It could not be the address of the person filling out the form itself.

    Webhoster/server strictness thingy, I believe. Hope this will help someone in the future.


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Any recent changes to wp_mail ?’ is closed to new replies.