• Yohan Perera

    (@thevirtualpreacher)


    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:
    https://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 [email protected] 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 :
    https://www.askapache.com/php/phpfreaks-eric-rosebrocks-phpmailer-tutorial.html.

    Do let us know if you need any further details.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Yohan Perera

    (@thevirtualpreacher)

    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 [email protected]. For example, your from address that you need to use in the script is @virtualpreacher.org or [email protected], 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.

    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…

    For WP-Email:

    In wp-email.php

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

    Replace:
    $mail->From = 'gamerz';
    $mail->FromName = '[email protected]';

    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: [email protected]';

    Thread Starter Yohan Perera

    (@thevirtualpreacher)

    WP-Email won’t work unless you replace,

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

    with

    $mail->From = ‘gamerz’;
    $mail->FromName = ‘[email protected]’;

    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: [email protected]’;

    din’t work…

    Try to resolve your issue by click here

    I think this link will give you some help.

    Thread Starter Yohan Perera

    (@thevirtualpreacher)

    The link you mentioned isn’t working…

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘WP-Email: Could not instantiate mail function’ is closed to new replies.