php - How to configure .env file avoid spam mail in Laravel 5.4 -


i working laravel 5.4. when sending mail local server mail going 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 

after shift live server , configure .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 in spam folder.how avoid spam folder.

here controller function

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 spam has nothing framework there couple of things check why happens:

  • is domain hosted on server sending email?
  • is correct spf record setup domain?
  • is message source valid? contain content might trigger spam filters?
  • are headers set properly?

these questions contribute emails not landing in spam it's not definite solution. :-)

some reading material:
php email - how avoid mail ending in spam box
how make sure email send programmatically not automatically marked spam?


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -