MyBB Community Forums
[Rejected] SMTP email using 'html' format with Amazon SES - Printable Version

+- MyBB Community Forums (
+-- Forum: Development (
+--- Forum: MyBB 1.8 Development (
+---- Forum: 1.8 Bugs and Issues (
+----- Forum: Rejected (
+----- Thread: [Rejected] SMTP email using 'html' format with Amazon SES (/thread-210909.html)

SMTP email using 'html' format with Amazon SES - Byte - 2017-06-06

I ran into this issue using the following:
  • Amazon SES SMTP (port 587 with TLS)
  • MyBB 1.8.11
  • Gmail as the receiving email user
Basically, I use the MyBB function my_mail to send mail (from inc/functions.php).

  define('IN_MYBB', 1);
  require "../global.php";
  require_once MYBB_ROOT."inc/functions.php";

  $user_email = "[email protected]";
  $from_email = "[email protected]";
  $email_message = "THIS IS A TEXT MESSAGE";

  $email_message = nl2br($email_message);
  $email_message = wordwrap($email_message, 70);
  $email_subject = "Testing email for new thing";
  //Send using MyBB mail
  my_mail($user_email, $email_subject, $email_message, $from_email, "", "", false, "html");

However, this would not work with Amazon SES SMTP. I tested various other SMTP providers which worked fine (SendGrid, Mailgun, etc).

Now changing the format from 'html' to 'text' or 'both' made it work fine.
I did some digging and discovered MyBB doesn't actually use 'html' format anywhere, only 'text' or 'both'.

I managed to fix this issue by commenting out the following line in: inc/class_mailhandler.php

$this->headers .= "Content-Transfer-Encoding: 8bit{$this->delimiter}{$this->delimiter}";

I'm not sure if this is a MyBB bug or oddity with Amazon SES SMTP.
Just posting here in case anyone else ever runs into this issue.

RE: SMTP email using 'html' format with Amazon SES - Byte - 2018-01-02

I found another Amazon SES issue.
Amazon SES doesn't allow a custom Return-Path header field to be set.
If it is, it should ignore the field but this was causing my emails to not send at all.

Fixed it by commenting out a line in /inc/class_mailhandler.php (in function set_common_headers()):

 $this->headers .= "Return-Path: {$this->return_email}{$this->delimiter}";