如何在Laravel 5.3中为zimbra邮件服务器配置mail.php?

时间:2017-05-29 09:12:07

标签: php laravel email laravel-5.3 zimbra

我创建VPS并在mail.mywebsite.com中安装zimbra mail,mywebsite.com在其他VPS中。

我在mail.php文件夹中的config

'driver' => 'smtp',
'host' => 'mail.mywebsite.com',
'from' => [
    'address' => 'customers@mywebsite.com',
    'name' => 'mywebsite.com'
],
'encryption' => env('MAIL_ENCRYPTION', 'No Encryption'),
'username' => 'info@mywebsite.com',
'password' => '*******',
'sendmail' => '/usr/sbin/sendmail -bs',

.env档案中:

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
  1. 我可以看到mail.mywebsite.com:7520
  2. 我的项目是Laravel 5.3
  3. 但发送邮件后,请看到此错误:

    Swift_TransportException in StreamBuffer.php line 268:
    Connection could not be established with host mail.mywebsite.com[Connection timed out #110]
    

    你能解决这个问题吗?

    谢谢。

1 个答案:

答案 0 :(得分:3)

.env文件将如下所示

MAIL_DRIVER=smtp
MAIL_HOST=smtp host
MAIL_PORT=25
MAIL_USERNAME=user_name
MAIL_PASSWORD=password
MAIL_ENCRYPTION=TLS