Latest

Monday, July 10, 2017

Why does my email are sended directly into spam?

Asked by: Vinicius Rosa


I'm creating an application that needs to send email to every die insert. I'm using Laravel's mailable tool, but whenever I send an email, it ends up falling in the spam box.

My form to send e-mail

<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Laravel</title>
  </head>
  <body>
    <div class="flex-center position-ref full-height">
      <form action="{{ route('sendmail')}}" method="post">
        <input type="email" name="mail" placeholder="mailaddress">
        <input type="text" name="title" id="title" placeholder="title">
        <button type="submit">Send me a mail</button>
        {{ csrf_field() }}
      </form>
    </div>
  </body>
</html>

My routes

Route::post('/sendmail', function (\Illuminate\Http\Request $request, \Illuminate\Mail\Mailer $mailer){

  $mailer->to($request->input('mail'))->send(new \App\Mail\MyMail($request->input('title')));

  return redirect()->back();
})->name('sendmail');

My .ENV Configuration

MAIL_DRIVER=mailgun
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=2525
MAIL_USERNAME=postmaster@xxxxxxxxxxxxxxxxxxx.mailgun.org
MAIL_PASSWORD=XXXXXXXXXXXXXXXXXXXXX
MAIL_ENCRYPTION=

Any suggestion? I'm try to send a simple message, without html tags something else like that. But still going to spam box. Thank's in advance!



Source

No comments:

Post a Comment

Adbox