-3

I'm using sendGrid to send emails. But my emails goes in spam folder. Here is code that I'm using for this.

<?php

$apiKey = "xxxxx.xxxxxx.xxxxxx";

 require("sendgrid-php/sendgrid-php.php");

$from = new SendGrid\Email("Example User", "azeemhaider77@gmail.com");

$subject = "Sending with SendGrid is Fun";

$to = new SendGrid\Email("Example User", "axeemhaider@gmail.com");

$content = new SendGrid\Content("text/plain", "and easy to do anywhere, even with PHP");

$mail = new SendGrid\Mail($from, $subject, $to, $content);


$sg = new \SendGrid($apiKey);

$response = $sg->client->mail()->send()->post($mail);

echo $response->statusCode();
var_dump($response->headers());
var_dump($response->body());

Why this is not working why these emails move into spam folder ?

Fiverr Projects
  • 311
  • 2
  • 4
  • 13

1 Answers1

0

It probably has nothing to do with your code, but with the content of your e-mail.

The only content is "and easy to do anywhere, even with PHP" and your "from" field is a random gmail account; that seems a lot like spam. Try to fill it up realistically, with what you actually would like to send.

Also see the google bulk email guidelines: https://support.google.com/mail/answer/81126?hl=en

Jeff Huijsmans
  • 1,388
  • 1
  • 14
  • 35
  • I changes text with original one "Hi, \n Thanks For Registering in our Application. \n You have 7 days to do so or you get bumped off the list and lose your position and your chance to win one of the free premium accounts" But still in spam folder. and both emails are actually exists – Fiverr Projects May 08 '17 at 08:25
  • I think it's not about this text, is it ? – Fiverr Projects May 08 '17 at 08:55