I announce that I cease all development and activity in the programming universe indefinitely. My career has reached the turning point I was not expecting for at least another year, leaving me highly off guard and without laid-out plans for this hobby's continuity. I have begun a 5-year residency program in Neurosurgery which is clearly not compatible, time-wise, with programming.
I gave in all my passion for developing, and you gave me back your loyalty and trust, even when I did not deserve that much. Now it is the time for payback. I release all my present and past work as Open Source software, in the hope some talented developer will continue maintaining and expanding my vision of a modern, sleek forum software. The intrinsic flexibility of MyBB is the true hidden gem of an otherwise outdated codebase; I do hope the project can continue and be updated complying to the latest coding standards.
I hereby thank Euan, kawaii, andrewjs18, Ben, Matt, Omar G., effone, Eric J., Devilshakerz, Wildcard, JordanMussi and all the other team members I have had the opportunity to work with when I was a MyBB team member. I thank Tomm M, my mentor, who inspired me to pick up coding with his piece-of-art plugins. And finally, I thank all of you MyBBoost subscribers who have helped me getting through my toughest university years economically.
Yours sincerely, Filippo
Replace the entire function with:function my_mail($to, $subject, $message, $from="", $charset="", $headers="", $keep_alive=false, $format="text", $message_text="", $return_email="")
{
global $mybb;
static $mail;
// Does our object not exist? Create it
if(!is_object($mail))
{
require_once MYBB_ROOT."inc/class_mailhandler.php";
if($mybb->settings['mail_handler'] == 'smtp')
{
require_once MYBB_ROOT."inc/mailhandlers/smtp.php";
$mail = new SmtpMail();
}
else
{
require_once MYBB_ROOT."inc/mailhandlers/php.php";
$mail = new PhpMail();
}
}
// Using SMTP based mail
if($mybb->settings['mail_handler'] == 'smtp')
{
if($keep_alive == true)
{
$mail->keep_alive = true;
}
}
// Using PHP based mail()
else
{
if($mybb->settings['mail_parameters'] != '')
{
$mail->additional_parameters = $mybb->settings['mail_parameters'];
}
}
// Build and send
$mail->build_message($to, $subject, $message, $from, $charset, $headers, $format, $message_text, $return_email);
return $mail->send();
}
Since we can manage errors in the SendGrid activity panel, we don't really care about returning true even if the $response is not 200 OK. Replace ###APIKEY### with the API Key you have saved some moments ago.function my_mail($to, $subject, $message, $from="", $charset="", $headers="", $keep_alive=false, $format="text", $message_text="", $return_email="")
{
global $mybb;
static $mail;
// Does our object not exist? Create it
/*if(!is_object($mail))
{
require_once MYBB_ROOT."inc/class_mailhandler.php";
if($mybb->settings['mail_handler'] == 'smtp')
{
require_once MYBB_ROOT."inc/mailhandlers/smtp.php";
$mail = new SmtpMail();
}
else
{
require_once MYBB_ROOT."inc/mailhandlers/php.php";
$mail = new PhpMail();
}
}
// Using SMTP based mail
if($mybb->settings['mail_handler'] == 'smtp')
{
if($keep_alive == true)
{
$mail->keep_alive = true;
}
}
// Using PHP based mail()
else
{
if($mybb->settings['mail_parameters'] != '')
{
$mail->additional_parameters = $mybb->settings['mail_parameters'];
}
}
// Build and send
$mail->build_message($to, $subject, $message, $from, $charset, $headers, $format, $message_text, $return_email);
return $mail->send();*/
if (!$to) {
return false;
}
require_once MYBB_ROOT . "inc/mailhandlers/sendgrid/sendgrid-php.php";
$sendgrid = new SendGrid('###APIKEY###');
if (!$from) {
$from = $mybb->settings['adminemail'];
}
$email = new SendGrid\Email();
->addTo($to)
->setFrom($from)
->setFromName($mybb->settings['bbname'])
->setSubject($subject)
->setText($message_text)
->setHtml($message)
;
$response = $sendgrid->send($email);
return true;
}
Filename | Size | Downloads |
---|---|---|
1.02 MB | 695 |