首页 > 解决方案 > 在 laravel .env 文件中配置发件人邮件地址

问题描述

我使用 laravel 5.6 应用程序来开发项目。在那个项目中,我必须向用户发送邮件。所以我想在文件中配置发件人邮件env地址mail.php

如果它是用于 gmail 的,那么我将在 env 文件中使用如下所示:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.io
MAIL_PORT=587
MAIL_USERNAME=vino@gmail.com
MAIL_PASSWORD=feaeda91d
MAIL_ENCRYPTION=TLS

然后在我的mail.php中:

'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),

但我没有使用 gmails 我想使用我的办公室电子邮件地址(vino123@xxx.in)并且域名是mail.xxx.in所以我不知道如何在我的和文件中配置主机驱动程序端口envmail.php

标签: laravel-5

解决方案


为此,您必须向负责管理该服务器的人员询问您办公室域中负责在接收电子邮件时发送的邮件服务器的所有相关信息。

MAIL_DRIVER=smtp
// The server IP address or domaine name of the mail server
MAIL_HOST=your_ofice_domaine_name.in
// Port on which the server is receiving email
MAIL_PORT=587 
// The username with which to make authentification on the mail server
MAIL_USERNAME=johndoe
// The password of the user
MAIL_PASSWORD=feaeda91d
// If the server is using encryption you can set it here
MAIL_ENCRYPTION=TLS

推荐阅读