Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Use FuelPHP's Email class with Google Apps or Gmail SMTP
  • This took me a little while to figure out, but it's easy to use Google Apps with Fuel's email class. Here are the important configuration options in app/config/email.php...
    return array(
        ... other options ...
        'driver' => 'smtp',   // duh!
        'smtp' => array(
            'host' => 'ssl://smtp.gmail.com',
            'port' => 465,
            'username' => 'googleusername',
            'password' => 'googlepassword',
            'timeout' => 5  // this can be whatever you want
        ),
        'newline' => "\r\n"
    );
    
    Troubleshooting: 1. Not authorized
    Check to be sure you included "ssl://" in host name and port 465 (I used to use PHPMailer with TLS over port 587. Those didn't work). 2. Hangs forever
    Check to be sure your newline is "\r\n" and not just "\n". I have no idea why that's important, but it is. Source:
    And old post on CodeIgnitor's forum about using their Email class with Gmail. I figured since FuelPHP's Email class came from CI (or something like that), any solution would be similar.
  • Thank you very much.
    I've been suffering from M$ services (hotmail, live, msn, windowslive) and using GMAIL with the Email package saves my day :)
  • The old Email class was derived from CI. The current email package is written from scratch.
  • Oh ok. Awesome. Well, the settings above still work (at least on 1.1-rc1). You guys rock. This is my feeble attempt at contributing haha.
  • Same goes if you are using Amazon SES smtp, with port 465 use ssl://email-smtp.us-east-1.amazonaws.com instead of just email-smtp.us-east-1.amazonaws.com
  • I got this error. Do you have any idea? 

    Fuel\Core\PhpErrorException [ Warning ]:
    stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed



  • That means the certificate store on the server, which holds the list of valid certificates, is out of date.

    On linux distro's, this is the ca-certificates package. Especially on "stable" distro's like RHEL or CentOS, it can be quite old. I used to import the file from the Fedora Rawhide repository to get a recent one.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion