Mail Setup for GMail

From GeeklogWiki
Jump to: navigation, search

GMail (or Google Mail) is Google's free email service. While originally only web-based, it has since added support for POP3, SMTP, and IMAP.

To use your GMail account to send emails from your Geeklog site, use this setup in your config.php (settings taken from here):

$_CONF['mail_settings'] = array (
    'backend' => 'smtp', // can be one of 'mail', 'sendmail', 'smtp'

    // sendmail parameters (only needed for 'backend' => 'sendmail')
    'sendmail_path' => '/usr/bin/sendmail',
    'sendmail_args' => '',

    // SMTP parameters (only needed for 'backend' => 'smtp')
    'host'     => 'smtp.gmail.com',
    'port'     => '587',
    'auth'     => true,
    'username' => 'your-account@gmail.com',
    'password' => 'your-gmail-password'
);

Note that your username must include the "@gmail.com". Also, while Google lists two possible ports, only 587 seems to work with Geeklog (or the PEAR::Mail class that Geeklog uses here). Don't forget to set auth to true!

Important: Emails sent via GMail will use your GMail account name and email address in the "From:", not the address set in $_CONF['site_mail']. This is different from other SMTP servers. So only use GMail if that isn't a problem for you.