2

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.

AnFi
  • 10,493
  • 3
  • 23
  • 47
Sterling Duchess
  • 1,970
  • 16
  • 51
  • 91

4 Answers4

4

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',
Community
  • 1
  • 1
LifeQuery
  • 3,202
  • 1
  • 26
  • 35
0

You probably figured it out by now, but I think the problem is with your

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

Try changing it to:

    $to = trim(Input::get('email'));
    $subject = 'Account activation.'; //for illustration purposes
    Mail::send('emails.activate', array('url' => $url), function($message) use ($to, $subject){
    $message->to($to)->subject($subject);
});
kJamesy
  • 5,973
  • 5
  • 20
  • 22
0

If gmail is blocking you and won't let you signin with your credentials try this.

Login with your gmail account and than go to: https://accounts.google.com/b/0/DisplayUnlockCaptcha

and click continue and than you have few minutes to send your mail with your code. After this google will allow signin to that account from the new source.

vstruhar
  • 185
  • 1
  • 3
  • 10
0

I know this is an old thread but for those who are interested. The current requirement for using your Gmail from localhost are quite different. You can configure your Laravel .env file as follows

MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=YOURID@GMAIL.COM
MAIL_PASSWORD=YOURPASSWORD
MAIL_ENCRYPTION=tls

OPTIONAL:

MAIL_FROM_ADDRESS=YOURID@gmail.com
MAIL_FROM_NAME="${APP_NAME}"

It will be advisable to have configured PHP to send emails before doing that on laravel. I use fake sendemail and it works. All you need to do is configure your sendemail.ini file.

You can check this post out on how to do that https://stackoverflow.com/a/18185233/14106184

Mikheil Zhghenti
  • 734
  • 8
  • 28
Viceodev
  • 31
  • 5