如何在Laravel 5.4中配置.env文件以避免垃圾邮件 [英] How to configure .env file avoid spam mail in Laravel 5.4

查看:183
本文介绍了如何在Laravel 5.4中配置.env文件以避免垃圾邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Laravel 5.4.当我从本地服务器发送邮件时,邮件将正常进入收件箱文件夹,请按以下步骤配置文件 .env :-

I am working with Laravel 5.4. When I am sending mail from Local server mail is going to the inbox folder working fine, configure file .env following :-

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=email
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls

此后,我转到实时服务器,并按以下步骤配置 .env 文件:->

After that I shift to live server and I configure the .env file following:->

MAIL_DRIVER=sendmail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=ssl

收到邮件但在垃圾邮件文件夹中.如何避免从垃圾邮件文件夹中删除邮件.

mail receive but in spam folder.How to avoid from spam folder.

这是我的控制器功能

function createSchool(Request $request){

        $this->validator($request->all())->validate();

        $user = $this->create($request->all());

        if($user){

            $mailInformation = $request->all();

            if($mailInformation){

                Mail::to($request->user())
                ->cc($mailInformation['email'])
                ->send(new SchoolRegistration($mailInformation)); 
            }

            return redirect('admin/schools')->with('success', 'School  added Successfully');
        }
    }

推荐答案

您的电子邮件是否为垃圾邮件与该框架无关,但您可以检查以下几项以防止其发生:

Your emails landing is spam has nothing to do with the framework but there are a couple of things that you could check why it happens:

  • 该域托管在发送电子邮件的服务器上吗?
  • 我的域是否正确设置了SPF记录?
  • 我的消息来源是否有效?它是否包含可能触发垃圾邮件过滤器的内容?
  • 标题是否设置正确?

这些问题使电子邮件没有进入垃圾邮件,但这不是一个确定的解决方案. :-)

These questions contribute to emails not landing in spam but it's not a definite solution. :-)

一些阅读材料:
php电子邮件-如何避免邮件以垃圾邮件箱
如何做您确定以编程方式发送的电子邮件不会自动标记为垃圾邮件吗?

Some reading material:
php email - how to avoid mail ending up in spam box
How do you make sure email you send programmatically is not automatically marked as spam?

这篇关于如何在Laravel 5.4中配置.env文件以避免垃圾邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆