0

I am using the SendGrid API to send some emails. When the emails show up in SendGrids back-end it says they were dropped and couldn't be sent. However, the emails that were dropped have this before them: 

So, I am assuming when I sent the email via the API these characters made it in there somehow?

Is there a PHP function I should call on the email before I send it over to them?

CRAIG
  • 977
  • 2
  • 11
  • 25
  • 1
    Check how your saving the file, its BOM (Byte Order Mark) – Lawrence Cherone Jan 23 '18 at 21:08
  • Hi @LawrenceCherone I am not saving it. I am pulling emails from my DB and then putting them into code to send them to SendGrid via their API. (Unless I am misunderstanding you.) – CRAIG Jan 23 '18 at 21:10
  • Are you using a view/template of sorts? – Lawrence Cherone Jan 23 '18 at 21:10
  • This page is running within wordpress. – CRAIG Jan 23 '18 at 21:11
  • Ok, how do you construct the email template? – Lawrence Cherone Jan 23 '18 at 21:13
  • See: https://stackoverflow.com/questions/18845976/whats-%C3%AF-sign-at-the-beginning-of-my-source-file, basically you need to find the file which constructs the email in a nice form and not just text, and then take out the BOM and save without BOM. – Lawrence Cherone Jan 23 '18 at 21:14
  • `$to = new SendGrid\Email($thename, $email); $content = new SendGrid\Content("text/plain", $content); $content = new SendGrid\Content("text/html", $htmlcontent); $mail = new SendGrid\Mail($from, $subject, $to, $content);` – CRAIG Jan 23 '18 at 21:15
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/163749/discussion-between-craig-and-lawrence-cherone). – CRAIG Jan 23 '18 at 21:16
  • Where is `$htmlcontent` created? If its all in the db, then remove the BOM from the database value. – Lawrence Cherone Jan 23 '18 at 21:16

0 Answers0