Howto set From mail with a name

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Anti-Spam Guide
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
Locked
Horus107
Registered User
Posts: 22
Joined: Fri Oct 21, 2005 1:57 pm

Howto set From mail with a name

Post by Horus107 » Mon Jun 09, 2008 10:00 pm

Hello,
how can I set the From email Header in a way that it also includes a name?

I tried setting the contact e-mail to "Garching 2 Forum <webmaster@xgm.de>" but it results in an escaped header: From: <"Garching 2Forum<webmaster"@xgm.de>>

Thanks,

Florian

User avatar
ameeck
Former Team Member
Posts: 6559
Joined: Mon Mar 21, 2005 6:57 pm

Re: Howto set From mail with a name

Post by ameeck » Tue Jun 10, 2008 2:45 pm

You'll have to change the code for this one, try looking for this line in functions_messenger.php and add the name you want or edit it to your liking:

Code: Select all

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

uwe.ha
Registered User
Posts: 39
Joined: Wed Mar 21, 2007 5:12 pm

Re: Howto set From mail with a name

Post by uwe.ha » Mon Aug 04, 2008 8:30 am

Hi Ameek,
ameeck wrote:You'll have to change the code for this one, try looking for this line in functions_messenger.php and add the name you want or edit it to your liking:

Code: Select all

        if (empty($this->from))
        {
            $this->from = '<' . $config['board_contact'] . '>';
        } 
That's it, thanks!
If somebody wants to know how or what to change:
In functions_messenger.php find:

Code: Select all

            $this->from = '<' . $config['board_contact'] . '>';
an replace with:

Code: Select all

			$this->from = '"' . $config['sitename'] . '"' . '<' . $config['board_contact'] . '>';
--
Uwe

User avatar
Dr.Death
QA Team
Posts: 363
Joined: Fri Apr 25, 2003 10:04 am
Location: Germany
Contact:

Re: Howto set From mail with a name

Post by Dr.Death » Mon Aug 04, 2008 9:00 am

What happens with UTF-8 $config['sitename'] entries ?
Doc.

User avatar
wang5555
Translator
Posts: 587
Joined: Wed Oct 27, 2004 2:57 pm
Location: Taiwan

Re: Howto set From mail with a name

Post by wang5555 » Mon Sep 01, 2008 2:29 pm

Dr.Death wrote:What happens with UTF-8 $config['sitename'] entries ?
Try it:

#
#-----[ OPEN ]-----
#
includes/functions_messenger.php

#
#-----[ FIND ]-----
#

Code: Select all

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

Code: Select all

		if (empty($this->from))
		{
			//$this->from = '<' . $config['board_contact'] . '>';
			// + UTF-8 
			mb_internal_encoding("UTF-8");
			$config['sitename'] = mb_encode_mimeheader($config['sitename'], 'UTF-8');
			// - UTF-8
			$this->from = '"' . $config['sitename'] . '"'. '<' . $config['board_contact'] . '>';
		}
#
#-----[ SAVE & CLOSE ]-----
#
It is more blessed to give than to reveive, welcome to letter, thanks & good-bye!
Good luck ^_^
Welcome to my forum!!
http://wang5555.hopto.org/phpBB3/
p.s. Shut down computer before 11 clock night!!!

User avatar
wang5555
Translator
Posts: 587
Joined: Wed Oct 27, 2004 2:57 pm
Location: Taiwan

Re: Howto set From mail with a name

Post by wang5555 » Sat Mar 19, 2011 8:21 am

wang5555 wrote:
Dr.Death wrote:What happens with UTF-8 $config['sitename'] entries ?
Try it:

#
#-----[ OPEN ]-----
#
includes/functions_messenger.php

#
#-----[ FIND ]-----
#

Code: Select all

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

Code: Select all

		if (empty($this->from))
		{
			//$this->from = '<' . $config['board_contact'] . '>';
			// + UTF-8 
			mb_internal_encoding("UTF-8");
			$config['sitename'] = mb_encode_mimeheader($config['sitename'], 'UTF-8');
			// - UTF-8
			$this->from = '"' . $config['sitename'] . '"'. '<' . $config['board_contact'] . '>';
		}
#
#-----[ SAVE & CLOSE ]-----
#
Maybe this method is better:

Code: Select all

		if (empty($this->from))
		{
			//$this->from = '<' . $config['board_contact'] . '>';
			mb_internal_encoding("UTF-8");
			$this->from = '"' . mb_encode_mimeheader($config['sitename'], 'UTF-8') . '"' . '<' . $config['board_contact'] . '>';
		}
It is more blessed to give than to reveive, welcome to letter, thanks & good-bye!
Good luck ^_^
Welcome to my forum!!
http://wang5555.hopto.org/phpBB3/
p.s. Shut down computer before 11 clock night!!!

Locked

Return to “[3.0.x] Support Forum”