0

On my web application that is built using Yii 2 PHP, We send out emails using Swiftmailer

It is configured to connect to an SMTP server to send the email - to avoid problems.

The Emails are in HTML and do have a link in the body of the mail. On gmail accounts these emails go straight to the spam folder. Any advice on how to fix this problem would be great please!

My Swiftmailer is configured as follow:

    'mailer' => [
        'class' => 'yii\swiftmailer\Mailer',
        'useFileTransport'=>false,
        'transport' => [
            'class' => 'Swift_SmtpTransport',
            'host' => 'mail.domainhere.com',
            'username' => 'address@domainhere.com',
            'password' => 'PASSWORDHERE',
            'port' => '465',
            'encryption' => 'ssl',
        ],
    ],

When i send emails to my own gmail account i get this warning on the email:

Be careful with this message. Many people marked similar messages as phishing scams, so this might contain unsafe content

Thanks! Jason

Mystx
  • 93
  • 1
  • 11

1 Answers1

2

This does probably not have anything to do with your code, if you just started sending emails from your (maybe new) domain it can take a while for the spamfilters of email services like Gmail/Outlook/etc to see that emails from your domain are not actually spam.

However, the content of your emails can have an influence on this. You can take a look here to see if your emails contain anything that might trigger the Gmail spam filters.

arjen Stens
  • 101
  • 1
  • 7
  • It seems that its the REPLY TO field. the domain i send the email from and the Reply To are different domains. once i remove the reply to its not flagged as spam anymore. Is there any way around this? – Mystx Oct 20 '17 at 08:56
  • @Mystx I don't know if there is a way around that. You could of course use the same domain for replies and then internally forward these replies to another domain. – arjen Stens Oct 20 '17 at 16:46