Opened 17 years ago

Closed 15 years ago

#618 closed Defect (fixed)

Inconsistency between EMAIL_FROM and EMAIL_FROM_NAME in email.inc

Reported by: tstrunk Owned by: davea
Priority: Trivial Milestone: Undetermined
Component: Web - Project Version:
Keywords: patch Cc:

Description

In WebConfig the documentation states:

EMAIL_FROM 
    'from' address for emails 
EMAIL_FROM_NAME 
    'from' name for emails 

PHP-Mailer respects these options; the internal php mail command does not:
email.inc (49-50):

        if (defined('EMAIL_FROM')) {
            $headers = "From: ". EMAIL_FROM;

should be:

        if ( defined('EMAIL_FROM') && defined('EMAIL_FROM_NAME') ) {
            $headers = "From: ".EMAIL_FROM_NAME."@".EMAIL_FROM;

Otherwise by specifying for example on host: "hostnumber1.com":
EMAIL_FROM - "hostnumber2.de"
EMAIL_FROM_NAME - "correct_username"

a password retrieval mail would be mailed to: hostnumber2.de@…

Revision is 14746

Change History (4)

comment:1 Changed 17 years ago by Nicolas

EMAIL_FROM is the full email address, not the hostname. EMAIL_FROM_NAME is the "displayed" name.

It should be:

        if ( defined('EMAIL_FROM') && defined('EMAIL_FROM_NAME') ) {
            $headers = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM.">";

So that with:

EMAIL_FROM - "fooproject@hostnumber2.de"
EMAIL_FROM_NAME - "Foo project admin" 

It gets sent with:

From: Foo project admin <foohome@hostnumber2.de>

I'm not too sure if EMAIL_FROM_NAME would work correctly if it had an @ sign, as would be common to use "Foo@Home admin"...

comment:2 Changed 17 years ago by tstrunk

Ah, yes - I misunderstood the documentation there. Thanks for clearing it up.

comment:3 Changed 17 years ago by Nicolas

Keywords: patch added

There is still a bug; although the fix is not what you initially suggested.

comment:4 Changed 15 years ago by davea

Resolution: fixed
Status: newclosed

fixed in [15059]

Note: See TracTickets for help on using tickets.