WordPress.org

Ready to get started?Download WordPress

Forums

GC Testimonials
Admin Email Notification (14 posts)

  1. neutraleyes
    Member
    Posted 5 months ago #

    Admin Email Notification is not working. in the settings tab, i have the box checked and have tried multiple email addresses. what could be the cause?

    http://wordpress.org/plugins/gc-testimonials/

  2. Chris Dillon
    Member
    Posted 5 months ago #

    There are several possible reasons.

    Let's start by checking if the mail protocol is enabled in PHP on your server. If you have access to your server's php.ini file, look for SMTP and smtp_port. Mine looks like this:

    [mail function]
    SMTP = localhost
    smtp_port = 25

    If you don't have access to the php.ini file, then create a file called phpinfo.php in your root directory and add this line to it:

    <?php phpinfo(); ?>

    View this in your browser (i.e. http://www.mydomain.com/phpinfo.php) and search the page for SMTP and smtp_port. Delete the file when you're done so as not to expose any configuration details to prying eyes.

    (Aside: I like to run this page once, copy the page to my Evernote so I have the details for just such an occasion, then delete the page.)

    Or ask your web host tech support if SMTP is enabled in PHP.

  3. neutraleyes
    Member
    Posted 5 months ago #

    mine looks the same as yours. now what?
    SMTP localhost localhost
    smtp_port 25 25

  4. Chris Dillon
    Member
    Posted 5 months ago #

    Good. Now let's check if the WordPress mail function is working. Use the example script on this site:
    http://www.butlerblog.com/2012/09/23/testing-the-wp_mail-function/

  5. neutraleyes
    Member
    Posted 5 months ago #

    it worked.

  6. Chris Dillon
    Member
    Posted 5 months ago #

    Good. So let's look at the values the plugin is working with. Add this before the wp_mail function in /wp-content/plugins/gc-testimonials/testimonials.php:

    echo 'To: '.$to.'<br>Subject: '.$subject.'<br>Message: '.$message.'<br>Headers: '.$headers;

    Line 604 if you're using an editor, or just edit the plugin via the admin screen and search for wp_mail.

    Then add a testimonial using the form. This will show the values right before being sent to wp_mail. No need to post the results, just let me know if the To: address and the From: address in the Headers look correct.

  7. neutraleyes
    Member
    Posted 4 months ago #

    I'm just going to post it all instead of trying to explain what i see.

    To: mycorrectemailaddress@gmail.com
    Subject: Testimonial Submission on Progressive Landscapes
    Message: You have received a testimonial submission on Progressive Landscapes. This is awaiting action from the administrator of the website.
    Headers: From: noreply@www.progressivelandscapes.ca X-Mailer: PHP/5.2.17

    thank you so much for walking me through this so far.
    i have also checked my spam and its not in there either.

  8. Chris Dillon
    Member
    Posted 4 months ago #

    I'm glad to help. We've ruled out the obvious. You can remove that line of code if you haven't already.

    Let's try this plugin:
    http://wordpress.org/plugins/wp-mail-smtp/
    It adds more control over the mail function.

    Select the options for
    Use the PHP mail() function to send emails.
    and
    No encryption.
    and
    No: Do not use SMTP authentication.
    and be sure to click [Save Changes].
    Then, at the the bottom of that admin page, try a test email. It will tell you whether or not it was able to send.

    If it fails, it lists out the variables and error codes so we'll need those - just copy that section to Notepad or something and we'll go from there.

  9. neutraleyes
    Member
    Posted 4 months ago #

    test email worked. testimonial email notification still not working.

  10. Chris Dillon
    Member
    Posted 4 months ago #

    Good, getting closer. I think your web host's security settings are bit tighter than average. That's a good thing.

    Let's try this. In testimonials.php, at line 602 (a couple lines above the wp_mail we searched for before):
    Disable this line by adding 2 slashes in front like this:

    // $headers = 'From: noreply@'.$_SERVER['HTTP_HOST'] . "\r\n" . 'X-Mailer: PHP/' . phpversion();

    then add this line right below it:

    $headers = 'From: noreply@'.str_replace('www.','',$_SERVER['HTTP_HOST']);

    We're fixing two things here. (1) The headers don't need the X-Mailer part because the wp_mail function already includes that. (2) Your web host may not like the www in the email address.

  11. neutraleyes
    Member
    Posted 4 months ago #

    voila! it works! thanks!
    after all that, i'm kinda disappointed by the email structure/content. i thought it would be more interactive like a comment moderation notification email where the admin wouldn't have to log in to the website to approve or deny.
    ah well.

  12. Chris Dillon
    Member
    Posted 4 months ago #

    You're welcome. I'm glad we figured it out.

    Chris

  13. chappie
    Member
    Posted 4 months ago #

    Very impressive, Chris. Thanks for sharing your knowledge. The topic isn't relevant to me but I love the way you processed the problem and found the solution.

    A thing of beauty.

  14. Chris Dillon
    Member
    Posted 4 months ago #

    Thank you chappie!

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.