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

Bcc recipients not delivery #29

Closed
BorjaCL opened this issue May 16, 2022 · 4 comments
Closed

Bcc recipients not delivery #29

BorjaCL opened this issue May 16, 2022 · 4 comments

Comments

@BorjaCL
Copy link

BorjaCL commented May 16, 2022

Since updating the package to work with Laravel 9, none of the bcc recipients are receiving emails. Is the same happening to anyone else?

@c-delouvencourt
Copy link

Same here the mail does not sent when cc or bcc is set

@wblommaert
Copy link
Contributor

I compared v3.1.0 to v4.0.0 of this package and noticed that in v4.0.0 the to parameter is no longer passed, which is where cc and bcc recipients were set in the past.

v3.1.0 used the following:

    public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
    {
        $this->beforeSendPerformed($message);

        $response = $this->client->request('POST', 'https://mandrillapp.com/api/1.0/messages/send-raw.json', [
            'form_params' => [
                'key' => $this->key,
                'to' => $this->getTo($message),
                'raw_message' => $message->toString(),
                'async' => true,
            ],
        ]);

        $message->getHeaders()->addTextHeader(
            'X-Message-ID', $this->getMessageId($response)
        );

        $this->sendPerformed($message);

        return $this->numberOfRecipients($message);
    }

note the 'to' => $this->getTo($message), when building the form_params array:

    protected function getTo(Swift_Mime_SimpleMessage $message)
    {
        $to = [];

        if ($message->getTo()) {
            $to = array_merge($to, array_keys($message->getTo()));
        }

        if ($message->getCc()) {
            $to = array_merge($to, array_keys($message->getCc()));
        }

        if ($message->getBcc()) {
            $to = array_merge($to, array_keys($message->getBcc()));
        }

        return $to;
    }

in v4.0.0 however this is missing, as shown below:

    protected function doSend(SentMessage $message): void
    {
        $message = $this->setHeaders($message);

        $this->mailchimp->messages->sendRaw([
            'raw_message' => $message->toString(),
            'async' => true,
        ]);
    }

I currently don't have time this week to try and fork this repository to see if adding the getTo method again would resolve this issue, so if anyone else can try that would be awesome. Else I'll give it a go this weekend when I have some time to look at this.

@wblommaert
Copy link
Contributor

@BorjaCL @c-delouvencourt I've opened a PR #34 that adds the behaviour from v3.x.x. Feel free to try out my fork and see if that fixes this issue for you both as well. If so, hopefully we can get it merged soon. Also, always happy to hear feedback!

@luisdalmolin
Copy link
Owner

PR is merged and this should be working on 4.0.2.

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

4 participants