Laravel: отправка электронной почты в папку со спамом - PullRequest
0 голосов
/ 17 ноября 2018

Gooday мам / сэр

Я столкнулся с проблемой в sendmail laravel. Сообщения отправляются в папку со спамом. Я новичок в такого рода проблем, любая помощь очень ценится. Кстати, я использую SMTP для отправки почты

Вот моя конфигурация:

В моем helpers.php

Mail::send($data['template'], $data, function ($message)
use ($sourceEmail, $header, $cc, $receiver, $file, $name, $subject)
{
    if($file != null){
        $message->attach($file->getRealPath(),
        [
            'as' => $file->getClientOriginalName(),
            'mime' => $file->getClientMimeType(),
        ]);
    }
    $message->from($sourceEmail);
    if(count($cc) > 0){
        $message->cc($cc);
    }
    if($name != null){
        $message->to($receiver, $name)->subject($subject);
    }else{
        $message->to($receiver)->subject($subject);
    }

});
if(count(Mail::failures()) > 0){
    $response  = array(
        'success' =>false,
        'data' => Mail::failures(),
    );
} else {
    $response  = array(
        'success' =>true,
    );
}
return $response;  

В моем контроллере:

     $data = array(
           'receiver' => $email,
           'messagecontent' => $message,
           'file' => $file,
           'subject' => ' Subscriber',
           'template' => 'front.bulk-email',
      );
     $resultEmail  = sendEmails(
              $data, // data in which render into view
             'company@gmail.com', //source email
             'Subscriber', //header
     );

В моем шаблоне

<div class="col-md-12">
<h3>
    Good day Subscriber,
</h3>
@if(!empty($messagecontent))
    {{ $messagecontent }}
@else
    <p>
        Thank you for subscribing at electricphil. You will receive the latest news and products.
    </p>
@endif
<hr>

Моя конфигурация .env, кажется, в порядке, поэтому не будет включать мою конфигурацию здесь Я уже проверил это в https://www.smtper.net/, используя мои учетные данные в .env и работает нормально.

...