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

[5.3] Apply global to email addres to CC and BCC #16705

Merged
merged 2 commits into from
Dec 8, 2016

Conversation

MrAtiebatie
Copy link
Contributor

As I was testing I noticed that the emails I was sending with Laravel were sent to the BCC address I provided. Unfortunately this wasn't the global "to email address" I set in the config/mail.php

I have created this pull request to fix this issue. I hope this will be merged because that's the way how I interpreted "global to address" and I think I'm not the only one. Correct me if I'm wrong!

@taylorotwell taylorotwell merged commit 49b8da4 into laravel:5.3 Dec 8, 2016
@taylorotwell
Copy link
Member

Makes sense to me.

@GrahamCampbell GrahamCampbell changed the title Apply global to email addres to CC and BCC [5.3] Apply global to email addres to CC and BCC Dec 8, 2016
@juukie
Copy link
Contributor

juukie commented Dec 17, 2016

So, if you have

'to' => ['address' => 'foo@example.com', 'name' => ''],

in your config/mail.php, previously added recipients will be overridden? Seems strange to me.

@MrAtiebatie you said the mail was sent to the BCC address you had provided. But you wanted it to be sent only to foo@example.com? I can only imagine it's handy when you want to make sure mail won't be sent to other addresses, when testing for example. Otherwise I wouldn't know why you would override recipients that might have been added before.

For example; when I'm having a form to request a testproduct, I often add the 'from' address as a BCC to the Thanks for your request message that would be sent to the visitor.
In local env I test this with Mailcatcher to make sure the message is send to both the visitor and the 'from' address.
With the 'to' address set I would only see one message sent to that address?

@devcircus
Copy link
Contributor

that is indeed the purpose of the 'Universal To' address. To have a single email address to send all mail to in development. If you'll be sending mail to users in production, do not utilize the 'Universal To'.
Laravel Mail Docs

@ejunker
Copy link
Contributor

ejunker commented Jan 13, 2017

Would it be useful to add a headers to the message to show the original recipients? Something like X-Original-To, X-Original-Cc, and X-Original-Bcc?

@gibbs
Copy link

gibbs commented Mar 19, 2017

Is there a way to disable this in an application? The mail service I'm using (SendGrid) doesn't allow duplicate emails.

@ghost
Copy link

ghost commented May 9, 2017

@devcircus

that is indeed the purpose of the 'Universal To' address. To have a single email address to send all mail to in development. If you'll be sending mail to users in production, do not utilize the 'Universal To'.
Laravel Mail Docs

It probably wouldn't hurt to add this to the Mail Docs, because it's not clear right now.
I came here because I was using the 'Universal To' and noticed that every email I sent, also had a CC with the same address.

Could it be a bug that an e-mail has a 'To' and a 'CC' when using 'Universal To' in config/mail.php?

@quiquegarcia
Copy link

This is coffusing even in documentation, many of our team it was thinking that

Something like this enables Universal To:

Mail::cc('hello2@example.com')
    ->send(new Mailable($data);

And this by pass Universal To:

Mail::to('hello@example.com')
    ->cc('hello2@example.com')
    ->send(new Mailable($data);

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

Successfully merging this pull request may close these issues.

7 participants