Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undisclosed recipients won't work with mail() #201

Closed
Fasse opened this issue Mar 23, 2014 · 1 comment
Closed

Undisclosed recipients won't work with mail() #201

Fasse opened this issue Mar 23, 2014 · 1 comment

Comments

@Fasse
Copy link

Fasse commented Mar 23, 2014

If you use the PHP mail() function for sending a mail and only set BCC recepients than "undisclosed-recipients:;" won't work.

I look into the code and there is a special way for mail in that case. In the method preSend there will be set "undisclosed-recipients:;" to the parameter $this->mailHeader but this parameter will not be used later anymore.

In the method createHeader() "undisclosed-recipients:;" is handled for the other send methods and it works.

As a simple hack I have changed the if in the createHeader() method so that "undisclosed-recipients:;" will be used if mail is used

    // To be created automatically by mail()
    if ($this->SingleTo === true) {
        if ($this->Mailer != 'mail') {
            foreach ($this->to as $t) {
                $this->SingleToArray[] = $this->addrFormat($t);
            }
        } 
    }
    else {
        if (count($this->to) > 0) {
            if ($this->Mailer != 'mail') {
                $result .= $this->addrAppend('To', $this->to);
            }
        } elseif (count($this->cc) == 0) {
            $result .= $this->headerLine('To', 'undisclosed-recipients:;');
        }
    }
Synchro added a commit to Synchro/PHPMailer that referenced this issue Mar 31, 2014
@Synchro
Copy link
Member

Synchro commented Mar 31, 2014

Thanks

@Synchro Synchro closed this as completed Mar 31, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants