apachelaravelsmtpxamppsendmail.exe

Laravel/XAMPP/Sendmail not sending mail


I have the same problem with XAMPP and WAMP. I'm unsure what causes this problem as there is absolutely nothing in log files.

I triple checked my configuration and everything is as it should be I even turned off my firewall and yet nothing happens.

Laravel 4 throw's this (timeout) exception: Symfony\Component\Debug\Exception\FatalErrorException

\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.php165

public function readLine($sequence)
{
    if (isset($this->_out) && !feof($this->_out)) {
        $line = fgets($this->_out);
        if (strlen($line)==0) {

This function Laravel 4 uses to read the template file. However no problem accessing the file either as it is properly named and in proper folder. The method that send's the mail is this one:

    Mail::send('emails.activate', array('url' => $url), function($message) {
        $message->to(trim(Input::get('email')))->subject('Account activation.');
    });

And Laravel's mail.php from config folder:

<?php

return array(
    'driver' => 'smtp', // Changed this to mail() and sendmail same error
    'host' => 'smtp.gmail.com',
    'port' => 465,
    'from' => array('address' => 'admin@localhost.com', 'name' => 'Support Team'),
    'encryption' => 'tls',
    'username' => '****@gmail.com',
    'password' => '*****',
    'sendmail' => 'C:\xampp\sendmail\sendmail.exe -t',
);

In my php.ini file I have:

[mail function]
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
SMTP = smtp.gmail.com
smtp_port = 465

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = ****@gmail.com


; XAMPP: Comment out this if you want to work with fakemail for forwarding to your mailbox (sendmail.exe in the sendmail folder)
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

And in my sendmail.ini I have:

smtp_server=smtp.gmail.com
smtp_port=465
smtp_ssl=auto
error_logfile=error.log
auth_username=****@gmail.com
auth_password=****
pop3_server=
pop3_username=
pop3_password=
force_sender=
force_recipient=
hostname=

I have everything set properly, i turned off firewall, checked my router cant trace it anyhow.


Solution

  • I posted an answer here that may solve this for some.

    In short, when using port 465, the default encryption setting needs to be changed from tls to ssl.

    'host' => 'smtp.gmail.com',
    'port' => 465, 
    'encryption' => 'ssl',