MyBB Community Forums

Full Version: Settings in the email system...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello!
I need help with a detail in the email settings.
I will try to explain very clearly:

My e-mail system is configured to send via SMTP and is working perfectly, all emails are being sent.

But the problem is that I can not add the sender's name (FromName) to Hearders, for example: My Board Name <[email protected]>.

In the class_mailhandler.php file, if the method of sending is via PHP the sender's name works normally:
            if($mybb->settings['mail_handler'] == 'smtp')
            {
                $this->from = $this->get_from_email();//<[email protected]>
            }
            else
            {
                //My Board Name<[email protected]>
                $this->from = '"'.$this->utf8_encode($mybb->settings['bbname']).'"';
                $this->from .= " <".$this->get_from_email().">";
            }

If I try to use the same method for SMTP it generates an error log:
i           f($mybb->settings['mail_handler'] == 'smtp')
            {
                //My Board Name<[email protected]>
                $this->from = '"'.$this->utf8_encode($mybb->settings['bbname']).'"';
                $this->from .= " <".$this->get_from_email().">";
            }
            else
            {
                //My Board Name<[email protected]>
                $this->from = '"'.$this->utf8_encode($mybb->settings['bbname']).'"';
                $this->from .= " <".$this->get_from_email().">";
            }


The error:
            if(!$this->send_data('MAIL FROM:<'.$this->from.'>', '250'))
            {
                $this->fatal_error("The mail server does not understand the MAIL FROM command. Reason: ".$this->get_error());
                return false;
            }


How can I set this up?
Thanks!
The from name isn't set in the "MAIL FROM" line, but instead in the "FROM" line, which the MyBB SMTP mail handler doesn't send. For an example of this line being sent, see here: https://en.wikipedia.org/wiki/Simple_Mai...rt_example
(2017-10-19, 04:57 PM)Euan T Wrote: [ -> ]The from name isn't set in the "MAIL FROM" line, but instead in the "FROM" line, which the MyBB SMTP mail handler doesn't send. For an example of this line being sent, see here: https://en.wikipedia.org/wiki/Simple_Mai...rt_example

Understood! Thanks!
But, how can I add FromName?
(2017-10-19, 05:15 PM)Walter_Correa Wrote: [ -> ]
(2017-10-19, 04:57 PM)Euan T Wrote: [ -> ]The from name isn't set in the "MAIL FROM" line, but instead in the "FROM" line, which the MyBB SMTP mail handler doesn't send. For an example of this line being sent, see here: https://en.wikipedia.org/wiki/Simple_Mai...rt_example

Understood! Thanks!
But, how can I add FromName?

You'll need to modify the SMTP mail handler. It should really be added into the core, so I've opened an issue on GitHub, here: https://github.com/mybb/mybb/issues/2883
Thanks!
Can you help me to edit or is not so easy? Sorry, but I'am newbie about PHP!
Sorry, I need to take some time to look at it and fix it. Once a developer has a solution, they'll create a Pull Request.
I fixed this.

I wouldn't necessarily recommend it but since the fix only involves one file, you could probably just overwrite that file (inc/class_mailhandler.php) and have it working straight away.