Apache Laravel/XAMPP/Sendmail不发送邮件

Apache Laravel/XAMPP/Sendmail不发送邮件,apache,laravel,smtp,xampp,sendmail.exe,Apache,Laravel,Smtp,Xampp,Sendmail.exe,我对XAMPP和WAMP也有同样的问题。我不确定是什么导致了这个问题,因为日志文件中根本没有任何内容 我三次检查了我的配置,一切正常,我甚至关闭了防火墙,但什么也没发生 Laravel 4抛出此(超时)异常:Symfony\Component\Debug\exception\FatalErrorException \vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.php165 public func

我对XAMPP和WAMP也有同样的问题。我不确定是什么导致了这个问题,因为日志文件中根本没有任何内容

我三次检查了我的配置,一切正常,我甚至关闭了防火墙,但什么也没发生

Laravel 4抛出此(超时)异常:
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) {
此函数Laravel 4用于读取模板文件。但是,访问该文件没有问题,因为它的名称正确,并且位于正确的文件夹中。发送邮件的方法如下:

    Mail::send('emails.activate', array('url' => $url), function($message) {
        $message->to(trim(Input::get('email')))->subject('Account activation.');
    });
和Laravel的mail.php(来自配置文件夹):

<?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',
);
在我的sendmail.ini中,我有:

[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"
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=

我把一切都设置好了,我关掉了防火墙,检查了我的路由器,但无论如何都无法追踪它。

你现在可能已经知道了,但我想问题出在你的电脑上

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

    $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);
});

你现在可能已经明白了,但我认为问题出在你的

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

    $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);
});
我发布了一个答案,也许可以解决一些问题

简而言之,当使用端口465时,需要将默认加密设置从tls更改为ssl

'host' => 'smtp.gmail.com',
'port' => 465, 
'encryption' => 'ssl',
我发布了一个答案,也许可以解决一些问题

简而言之,当使用端口465时,需要将默认加密设置从tls更改为ssl

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

如果gmail阻止了你,并且不允许你用你的凭据登录,试试这个

使用您的gmail帐户登录,然后转到:

然后单击“继续”,您将有几分钟的时间发送带有代码的邮件。
在此之后,谷歌将允许从新来源登录到该帐户。

如果gmail阻止了您,并且不允许您使用您的凭据登录,请尝试此操作

使用您的gmail帐户登录,然后转到:

然后单击“继续”,您将有几分钟的时间发送带有代码的邮件。
在此之后,谷歌将允许从新的来源登录到该帐户。

我知道这是一个旧线程,但对于那些感兴趣的人来说。当前从本地主机使用Gmail的要求是完全不同的。您可以如下配置您的Laravel.env文件

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

MAIL_FROM_ADDRESS=YOURID@gmail.com
MAIL_FROM_NAME="${APP_NAME}"
建议先将PHP配置为发送电子邮件,然后再在laravel上发送电子邮件。我使用假sendemail,而且很有效。您只需配置
sendmail.ini文件

你可以查看这篇文章,了解如何做到这一点

我知道这是一个古老的主题,但对于那些感兴趣的人来说。当前从本地主机使用Gmail的要求是完全不同的。您可以如下配置您的Laravel.env文件

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

MAIL_FROM_ADDRESS=YOURID@gmail.com
MAIL_FROM_NAME="${APP_NAME}"
建议先将PHP配置为发送电子邮件,然后再在laravel上发送电子邮件。我使用假sendemail,而且很有效。您只需配置
sendmail.ini文件

你可以查看这篇文章,了解如何做到这一点