2

I send an email to my customers with a receipt. I am using my server to send this email from my business email @gmail.com and it contains a link to the receipt image on my server. However, gmail labels it as possibly phishing, specifically that it is not from my business email address. What can I do to stop it from claiming it as phishing?

<?php
   $mifb = $_GET["mifb"]; //link to the receipt pic on my server
  $tpppp = $_GET["tpppp"]; //customer email
   $fyppp = $_GET["fyppp"]; //my business email @gmail.com
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To: <'. $tpppp.'>' . "\r\n";
$headers .= 'From: <'. $fyppp.'>' . "\r\n";
$message = '<!DOCTYPE html><html><body><a href="http://www.mybusinesswebsite.com"><img src= '.$mifb.'></a>The receipt is in an image format</body></html>';

mail($tpppp, 'For Customer George Walters', $message, $headers);
?>
  • 1
    That's because your `From` header doesn't match the envelope sender. You can add a fifth parameter, `-f` to `mail()` to fix this. See http://stackoverflow.com/a/7519120/3794472. In your case, you should use something like SwiftMailer and relay through GMail's SMTP server because the spf records will be incorrect, causing your mail to still go to spam. See http://stackoverflow.com/q/3536836/3794472 – Jeremiah Winsley Dec 17 '14 at 16:27
  • 1
    Is the `From` field filled with a GMail-address? – RichardBernards Dec 17 '14 at 16:27
  • How would I use Swift_SmtpTransport::newInstance in my code @Jeremiah Winsley? -f did not fix it. –  Dec 17 '14 at 16:34
  • Try http://nuclearprojects.com/blog/setting-up-swift-mailer-to-send-through-google-apps-smtp-servers/ for a tutorial. – Jeremiah Winsley Dec 17 '14 at 16:38

1 Answers1

0

You have to use SMTP for proper sending your email via gmail. Here is how: https://stackoverflow.com/a/2748837/4362168

Alternative try to use services like mandrill, postmark or amazon ses It's pretty simple to setup, and they will guide you through the process o setting proper spf and dkim records for your domain so emails you send will be more trustworthy.

Community
  • 1
  • 1
gellu
  • 136
  • 5