WordPress.org

Ready to get started?Download WordPress

Forums

WP-Email: Could not instantiate mail function (7 posts)

  1. TheVirtualPreacher
    Member
    Posted 2 years ago #

    I am using WP-Email and WP-DB Manager in my blog. As of yesterday I tried to email a database backup to an email address of my choice when it complained it couldn't email the backup file. Out of curiosity I checked whether WP-Email is working and it throws the error "Could not instantiate mail function"

    I thought my host probably switched off the PHP: Mail function and contacted them immediately. To my surprise they said it's on, not off. As I was suspecious I tested the function myself using some PHP code and the result was positive.

    I assumed it should be a problem with the plugins. Then I rememebered there's no way both plugins could go down at the same time. I tested WP-DB Manager in a blog hosted in another server from a different hosting provider and it worked without any issue. Any idea what's keeping the plugins from calling the Mail() function? Both plugins were functioning well until yesterday.

    I tried the following,

    1. Disabling all the other plugins
    2. Reinstalling WordPress
    3. Reinstalling WP-DB Manager
    4. Clearing the cache (I am using WP-Super Cache)

    Nothing has worked so far.

    One thing I know for sure. This has nothing to do with WordPress or the plugins in question. The problem is because of configuration error in the server. I contacted the hosting company. Given below is their response. I couldn't extract any clues or solutions from their reply however.

    In order to send email from the server via PHP, I suggest you use the code specified in the below link:
    http://manage.bigrock.in/kb/servlet/KBServlet/faq1060.html

    We have tested this script and it works seamlessly.

    PHP Mailer is a PHP email transport class and mail() is a function under it.

    I have tested the PHP Mail function using a PHP mail script and it was working fine. I have uploaded the test mail script (i.e. testmail.php) under public_html. I have mentioned mailhostingserver@gmail.com to receive mail and i was able to receive mail. Hence I request you to check the same at your end and confirm.

    PHPMailer is a PHP email transport class featuring file attachments, SMTP servers, CCs, BCCs, HTML messages, word wrap, and more. Sends email via sendmail, PHP mail(), QMail, or directly with SMTP. Support for additional transports, such as SMS, MMS will be forthcoming.
    Using phpmail script we can check whether phpmailer is functioning or not.

    Please refer following URL for more details on PHPMailer :
    http://www.askapache.com/php/phpfreaks-eric-rosebrocks-phpmailer-tutorial.html.

    Do let us know if you need any further details.

  2. TheVirtualPreacher
    Member
    Posted 2 years ago #

    Finally my web host let the cat out of the bag... Sadly the answer only leads to more questions. Given below are the instructions from the host. Does anybody know how to implement these instructions in WordPress?

    Due to recent spam attacks originating from our servers, we are enforcing the check on the from address that can be used to send the emails through mail scripts. The from address has to be anyhting@your-domain-name.tld. For example, your from address that you need to use in the script is @virtualpreacher.org or donotreply@virtualpreacher.org, or any other email address with virtualpreacher.org.

    Since you want to receive the backup of your database, you need to mention the from address as one of your email accounts within your domain name where you will get the mail with your contents. You can also check if there is any FROM address field in your script and mention a email ID as @virtualpreacher.org there. You can test this.

    You will have to make the appropriate changes in your script to avoid this issue at your end.

  3. Clicknathan
    Member
    Posted 2 years ago #

    I'm having this issue as well. Any ideas what else might be done? The solution above, regarding making sure the from address is our domain, didn't do the trick either...

  4. Lester Chan
    Member
    Posted 2 years ago #

    For WP-Email:

    In wp-email.php

    Find:
    $mail->From = $youremail;
    $mail->FromName = $yourname;

    Replace:
    $mail->From = 'gamerz';
    $mail->FromName = 'gamerz@lesterchan.net';

    For WP-DBManager:

    In wp-dbmanager.php

    Find:
    $mail_header = 'From: '.wp_specialchars_decode(get_option('blogname')).' Administrator <'.get_option('admin_email').'>';

    Replace:
    $mail_header = 'From: gamerz@lesterchan.net';

  5. TheVirtualPreacher
    Member
    Posted 2 years ago #

    WP-Email won't work unless you replace,

    $mail->From = $youremail;
    $mail->FromName = $yourname;

    with

    $mail->From = 'gamerz';
    $mail->FromName = 'gamerz@lesterchan.net';

    Replacing the variables with your own domain name won't work. But this is OK. Something is better than nothing. (Thanks GamerZ...)

    In WP-DB Manager.php however removing,

    $mail_header = 'From: '.wp_specialchars_decode(get_option('blogname')).' Administrator <'.get_option('admin_email').'>';

    and placing,

    $mail_header = 'From: gamerz@lesterchan.net';

    din't work...

  6. siitindia
    Member
    Posted 1 year ago #

    Try to resolve your issue by click here

    I think this link will give you some help.

  7. TheVirtualPreacher
    Member
    Posted 1 year ago #

    The link you mentioned isn't working...

Topic Closed

This topic has been closed to new replies.

About this Topic