MyBB Community Forums

Full Version: Put "Name From" when an email is dispatched using SMTP
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I was sending emails using MyBB 1.6.10 and my smtp server but the emails was arriving without the forum's name. Example:
From: <postmaster@example>

My target was that this email arrived like this:
From: Forum Messages <postmaster@example>

So, I solved this and now I'm sharing with yours. I found a problem in the code. To solve, just change this:

//%forum_folder%/public/inc/class_mailhandler.php
Line 283

function set_common_headers()
{
	global $mybb;

	// Build mail headers
	$this->headers .= "From: {$mybb->settings['bbname']} <{$this->from}>{$this->delimiter}";

	if($this->return_email)
...

I just added "global $mybb" and change the "From" header.

Hugs! Cool
HI dudumiquim,

I've tried this but my emails still appear to come from [email protected].

I've set mine as:


function set_common_headers()
	{
		global $mybb;

		// Build mail headers
                $this->headers .= "From: {$mybb->settings['TorqueZone Team']} <{$this->from}>{$this->delimiter}";
		
		if($this->return_email)


My class_mailhandler.php already had the "global $mybb" line it. Do I need to edit something else here?
^ @ MatBat, you can replace From: {$mybb->settings['bbname']} with From: TorqueZone Team
(note: {$mybb->settings['TorqueZone Team']} is not correct)
Ahhh Brilliant.

Many thanks! Excellent fix!