WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] No email notification - registration or comments (4 posts)

  1. eantics
    Member
    Posted 5 years ago #

    Hope someone can help

    My WordPress install does not send any emails. It is version 2.6 and is hosted on Fast Hosts. Now Fast Hosts have some additional steps required in order to send an email from their servers

    1) that either the "to" or "from" email address is a hosted fasthosts mailbox

    2) that ini_set("sendmail_from", $from_email) is set

    3) and that -f parameter is passed in the mail function with the from address

    So in view of this I thought there might be something obvious to tweak in the "class-phpmailer.php". I couldn't see anything but made some amends to force it to use the from I account I wanted just in case and still did not work.

    So I went to the pluggable.php file where the class is used, and replaced the wp_mail function with a script I have been able to test on the server and get to send email.

    This is the new function

    function wp_mail( $to, $subject, $message, $headers = '' ) {
    
    	$email_from="wordpress@eantics.co.uk"; // Make sure this is a fasthosts hosted email address
    	$email_to = $to;
    	ini_set("sendmail_from", $email_from);
    	$email_subject = $subject;
    	$email_headers = "From: $email_from"."\r\n"."Reply-To: $email_from"."\r\n";
    
    	$email_message= $message;
    	$sent = mail($email_to, $email_subject, $email_message, $email_headers, "-f".$email_from);
    	return $sent;
    }

    But this does not send any email from WordPress either, (registration or comment notification).

    I've been looking at this for hours so would appreciate your help and fresh eyes.

    Thanks

    Ollie

  2. eantics
    Member
    Posted 5 years ago #

    Just a bump/update on this.

    This is not a host/fasthosts issue. I can include pluggable.php from a separate testmail php file that I've created, call wp_mail() passing appropriate function parameters and an email is sent.

    So it would appear that either:-
    - WordPress is not calling wp_mail or
    - It is calling it and passing bad parameters that prevent the function running.

    Does this mean anything to anyone - can you help?

    Thanks

    Ollie

  3. eantics
    Member
    Posted 5 years ago #

    Resolved, was going round in circles. The new script for fasthosts does indeed work, I'd changed something else in Admin settings, so didn't see the impact of it.

  4. juliageek
    Member
    Posted 5 years ago #

    Hi Ollie
    Can you please tell me which lines you replaced in the pluggable.php file? - in 2.8?
    Thanks - I'm having the exact same problem
    Julia

Topic Closed

This topic has been closed to new replies.

About this Topic