简体   繁体   中英

Laravel Markdown - Emails sent to gmail address being marked as spam

This is my email template

@component('mail::message')
<img src="{{ URL::asset("https://mywebsite.com/openUpdate/$userId") }}" width="1" height="1" alt="">
# Hello {{$userName}},

----Email Body-----

@component('mail::button', ['url' => 'https://mywebsite.com/redirecting/' . $userId])
Click here to confirm your appointment
@endcomponent

{{ config('app.name') }}<br>
Click <a href="{{ URL::asset("https://mywebsite.com/unsubscribe/$userId") }}">here</a> to un-subscribe.

@endcomponent

Whenever I send this email to a Gmail address I get the following error stating that my email is marked as possible spam

This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed:

myemail@gmail.com
host 5817.smtp.antispamcloud.com [38.89.254.164]
SMTP error from remote mail server after end of data:
550 High probability of spam
Reporting-MTA: dns; nwpro2.fcomet.com

Action: failed
Final-Recipient: rfc822;myemail@gmail.com
Status: 5.0.0
Remote-MTA: dns; 5817.smtp.antispamcloud.com
Diagnostic-Code: smtp; 550 High probability of spam

It fails even if I strip down my email to only @component('mail::message') at the beginning and @endcomponent at the end.

It is however accepting just plain text.

How can I ensure email is properly delivered and not marked as spam?

Using server php mail() function always bad idea, because your hosting provider is hosting service, not mail transfer service. It's different services. If you want to get mails into inbox you may order vps with dedicated IP address and start managing domain/ip reputation, or you can order services from sendgrid, mailgun or etc. Also be ready to implement standard email policy like 2 opt in, and even better - you can check mails before sending with some service like mailcheck.co You need really low bounce rate on your mails to keep good reputation of your ip/domain. If you use some 3rd party mail sending service they will manage ip reputation for you, but also they will measure yours bound rate and spam rate. If your rates will be above average they will ban yours account. Sending email nowdays isn't easy task due to numerous technologies related to antispam, like DKIM, SPF, DMARC etc. In conclusion - I still got spam in my inbox, but I can't send email from my server anymore without extra efforts.

I faced the same problem, but I stopped using markdown and using view() for now.

Of course, we need to have a plain HTML template for view blade files.

(UPDATED=>)

The actual problem was: There was one link on the button and it was different from the sender domain. We should include links that can have the sender domain used.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM