how to change "From" in email

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Scam Warning
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
Locked
nasirmajor
Registered User
Posts: 8
Joined: Tue Aug 26, 2008 12:19 pm

how to change "From" in email

Post by nasirmajor » Sun Jul 25, 2010 9:15 am

When i email from my forum and after its received the "From" address look like this
where as i want it like this
From: "Software Developers Forum" <info@softwaredevelopers.com.pk>
how can i change this thing?

nasirmajor
Registered User
Posts: 8
Joined: Tue Aug 26, 2008 12:19 pm

Re: how to change "From" in email

Post by nasirmajor » Sun Jul 25, 2010 1:41 pm

no reply yet :(

User avatar
ric323
Former Team Member
Posts: 22909
Joined: Tue Feb 06, 2007 12:33 am
Location: Melbourne, Australia
Name: Ric
Contact:

Re: how to change "From" in email

Post by ric323 » Sun Jul 25, 2010 1:44 pm

Please be a bit more patient, and note our 6-hour bump rule. http://www.phpbb.com/rules/#rule4g
The Knowledge Base contains solutions to many common problems!
How to fix "Doesn't have a default value" and "Incorrect string value: xxx for column 'post_text' " errors.
How to do a clean re-install of the latest phpBB3 version.
Problems with permissions? Read phpBB3 Permissions

nasirmajor
Registered User
Posts: 8
Joined: Tue Aug 26, 2008 12:19 pm

Re: how to change "From" in email

Post by nasirmajor » Tue Jul 27, 2010 4:46 am

i have a good PHP experience too. If someone can tell me the exact place where to change i will do it myself. Any guidance please?

User avatar
AmigoJack
Registered User
Posts: 5602
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: how to change "From" in email

Post by AmigoJack » Tue Jul 27, 2010 8:09 am

If we're talking about version 3.0.7-PL1:
go to /includes/functions_messengers.php into function msg_email() (might be line 424) and find

Code: Select all

        if (empty($this->replyto))
        {
            $this->replyto = '<' . $config['board_contact'] . '>';
        }

        if (empty($this->from))
        {
            $this->from = '<' . $config['board_contact'] . '>';
        }

        $encode_eol = ($config['smtp_delivery']) ? "\r\n" : $this->eol; 
Replace this with:

Code: Select all

        $encode_eol = ($config['smtp_delivery']) ? "\r\n" : $this->eol;

        if (empty($this->replyto))
        {
            $this->replyto = mail_encode($config['sitename'], $encode_eol) . ' <' . $config['board_contact'] . '>';
        }

        if (empty($this->from))
        {
            $this->from = mail_encode($config['sitename'], $encode_eol) . ' <' . $config['board_contact'] . '>';
        } 
This will carry the site name as e-mail address name. Pay attention to push the line with $encode_eol above both if-clauses.
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

nasirmajor
Registered User
Posts: 8
Joined: Tue Aug 26, 2008 12:19 pm

Re: how to change "From" in email

Post by nasirmajor » Sat Jul 31, 2010 1:58 am

Thank you i will try it.

asavage
Registered User
Posts: 32
Joined: Sun Dec 04, 2005 8:50 pm
Location: Duvall, Wash.
Name: Al Savage
Contact:

Re: how to change "From" in email

Post by asavage » Mon Apr 28, 2014 11:40 pm

AmigoJack wrote:If we're talking about version 3.0.7-PL1:
go to /includes/functions_messengers.php into function msg_email() (might be line 424) and find

Code: Select all

        if (empty($this->replyto))
        {
            $this->replyto = '<' . $config['board_contact'] . '>';
        }

        if (empty($this->from))
        {
            $this->from = '<' . $config['board_contact'] . '>';
        }

        $encode_eol = ($config['smtp_delivery']) ? "\r\n" : $this->eol; 
Replace this with:

Code: Select all

        $encode_eol = ($config['smtp_delivery']) ? "\r\n" : $this->eol;

        if (empty($this->replyto))
        {
            $this->replyto = mail_encode($config['sitename'], $encode_eol) . ' <' . $config['board_contact'] . '>';
        }

        if (empty($this->from))
        {
            $this->from = mail_encode($config['sitename'], $encode_eol) . ' <' . $config['board_contact'] . '>';
        } 
This will carry the site name as e-mail address name. Pay attention to push the line with $encode_eol above both if-clauses.
This seems to work fine on my 3.0.12 installation, with the exception that in mine, the first FIND has the

Code: Select all

     $encode_eol = ($config['smtp_delivery']) ? "\r\n" : $this->eol; 
located above the code block, not at the end (ie it looks like your structure before I edit it).

Thanks for posting this (nearly four years ago), it was very helpful.
Regards,
Al S.

Locked

Return to “[3.0.x] Support Forum”