首页 > 解决方案 > 未发送到 office365 邮件客户端的电子邮件

问题描述

我想从我的 laravel 应用程序发送一些电子邮件。电子邮件会发送到 Gmail、Yahoo 和一些个人电子邮件帐户,但不会将电子邮件发送到 office 365 电子邮件帐户。在其他服务中,收件箱文件夹中收到的电子邮件。
我尝试了其他一些 SMTP 服务器(Google 和我的托管 SMTP),但不会从 Laravel 应用程序发送任何电子邮件。
这是我的 .env 文件:

MAIL_DRIVER=smtp
MAIL_HOST=cpanel2.mylittledatacenter.com
MAIL_PORT=465
MAIL_USERNAME=info@schoolearn.ir
MAIL_PASSWORD=*****
MAIL_ENCRYPTION=ssl

这是我的发送电子邮件课程:

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class confirmationEmail extends Mailable implements ShouldQueue
{
    use Queueable, SerializesModels;
    private $userName = null;
    private $link = null;
    private $isConfirmed = null;


    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct($username,$link,$isConfirmed)
    {
        //
        $this->userName = $username;
        $this->link = $link;
        $this->isConfirmed = $isConfirmed;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        info("ConfirmationEmail: link: $this->link|isConfirmed:$this->isConfirmed");
        return $this->from('info@test.com','test name')->subject("test title")->view('email_templates.Confirmation')->with(['name'=>$this->userName,'link'=>$this->link, 'isConfirmed'=>$this->isConfirmed]);
    }
}

我认为可以通过在电子邮件中添加一些标题来解决。但我不知道我该怎么做。

标签: phplaravelemailsmtpoffice365

解决方案


推荐阅读