2017-06-06, 06:59 PM
I ran into this issue using the following:
Example:
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
https://github.com/mybb/mybb/blob/52dde2...r.php#L302
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.
- Amazon SES SMTP (port 587 with TLS)
- MyBB 1.8.11
- Gmail as the receiving email user
Example:
<?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
https://github.com/mybb/mybb/blob/52dde2...r.php#L302
$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.