The MU forums have moved to WordPress.org

Howto: setup SMTP without plugins (7 posts)

  1. gcrick
    Member
    Posted 16 years ago #

    Looking through the forums, there seem to be quite a few people who need to use an external SMTP server for mail. There are plugins which allow for SMTP configuration (http://www.coffee2code.com/archives/2004/06/28/plugin-wpphpmailer/ is mentioned many times in the forums), but the problem is with installation. An email is sent giving the admin password, and the admin password is needed to install plugins...you see the problem.
    One solution is to change the admin password in the database, as explained in http://www.tamba2.org.uk/wordpress/phpmyadmin/. This only works if you have access to the database of course, and can be a little harder if you don't have phpMyAdmin.
    Another solution is to modify the source code of WPMU. The way I did it requires changes in 2 files. Please note that this is a quick fix, and I don't normally recommend putting things like an smtp host in the source code! It would probably be best to install the plugin above once you have admin access.
    In /wp-includes/pluggable.php around line 197, change

    $phpmailer->IsMail();
    to
    $phpmailer->IsSMTP();

    In /wp-includes/class-phpmailer.php, look for the section labeled "SMTP VARIABLES", and change them to the values of your server ($Host, $Port, $Password, etc).
    If you don't have access to either the database or the code, you are probably out of luck.

  2. coinoperatedboy
    Member
    Posted 16 years ago #

    Is this compatible with Google Apps smtp?

  3. lunabyte
    Member
    Posted 16 years ago #

    If you specify a port and such, yes it should be.

  4. coinoperatedboy
    Member
    Posted 16 years ago #

    >If you specify a port and such, yes it should be.

    I have specified the port and such, and it isn't. I still get this error:

    "The e-mail could not be sent.
    Possible reason: your host may have disabled the mail() function..."

  5. mobiletechguy
    Member
    Posted 16 years ago #

    gcrick: thanks for the post and it works well for me.

    coinoperatedboy: you may have done that - did you change this line in /wp-includes/class-phpmailer.php from:

    var $SMTPAuth = false;

    to:

    var $SMTPAuth = true;

    mtg

  6. Phentis
    Member
    Posted 16 years ago #

    var $Host = "smtp.google.com";
    var $Port = 465;
    var $Helo = "";
    var $SMTPAuth = true;
    var $Username = "phentis";
    var $Password = "herepassword";
    var $Timeout = 10;
    var $SMTPDebug = true;
    var $SMTPKeepAlive = false;
    var $smtp = NULL;
    var $to = array();
    var $cc = array();
    var $bcc = array();
    var $ReplyTo = array();
    var $attachment = array();
    var $CustomHeader = array();
    var $message_type = "";
    var $boundary = array();
    var $language = array();
    var $error_count = 0;
    var $LE = "\n";

    Did I write correctly?

    The Problem is that I get message:
    SMTP -> ERROR: Failed to connect to server: ()

  7. diamondx
    Member
    Posted 15 years ago #

    i think it's smtp.gmail.com

About this Topic