Skip to content
New issue

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

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

Already on GitHub? # to your account

Ability to cc/bcc? #19

Closed
georgiosd opened this issue Mar 25, 2018 · 14 comments
Closed

Ability to cc/bcc? #19

georgiosd opened this issue Mar 25, 2018 · 14 comments

Comments

@georgiosd
Copy link
Contributor

I guess it's not implemented? If I send you a PR, will you publish a new nuget?

@StrangeWill
Copy link
Contributor

StrangeWill commented Mar 26, 2018

Well we use Transmissions (https://developers.sparkpost.com/api/transmissions.html) which are used for mass mailing, CC/BCC should have no affect (AFAIK: not supported on transmissions) because having multiple receipts shouldn't put them all in the "to" list, but individually mailed with each one as a single recipient.

We do not currently support the basic SMTP API though, where TO/CC/BCC makes more sense, if you wanted to implement that, of course we'll accept a PR for that (and of course push that out to NuGet). :D

I would be interested in the use case though were transmissions weren't good enough for this (unless the requirement is that you do see everyone that is in the recipient list).

@georgiosd
Copy link
Contributor Author

georgiosd commented Mar 26, 2018

That's where I looked too! See section "Request: Create Transmission Using CC Header" - seems to support it ok, no?

Basically I am trying to send a copy of the outgoing emails to ourselves.

I added the CC in the headers collection as in the example but I got interrupted so I'm not sure if it works yet :S

@StrangeWill
Copy link
Contributor

StrangeWill commented Mar 26, 2018

Ah yeah, using the header section, didn't consider that!

You should be able to currently do this without changing the library:

transmission.Content.Headers = new
{
    cc = "myemail@example.com",
    bcc = "someother@example.com"
};

Though maybe we should move to a Dictionary<string, object> instead of an object, but due to it being the SMTP header that we're tampering with I shy away from implementing a strongly typed object (because you can specify your own custom headers). We could do some weird hybrid object like we have prototyped in SegmentDotNet here: https://github.com/StrangeWill/SegmentDotNet/blob/release/0.1.0/src/SegmentDotNet/PropertyContainers/Serializers/PropertyContainerBaseSerializer.cs).

Let me know if you'd rather this be implemented a different way. I know it's not intuitive but I can't think of a nice way to make header tampering both intuitive and as flexible as it needs to be without doing the same we do in our SegmentDotNet stuff (which I wouldn't mind breaking out if it makes sense, it's just not tested much).

@georgiosd
Copy link
Contributor Author

georgiosd commented Mar 26, 2018

Frankly I'm happy with a Dictionary :)

Maybe include an example.

The full framework SparkPost C# SDK adds a Type enum attribute (To|Cc|Bcc) and handles it internally. But as long as I can find it, I don't particularly care :)

@StrangeWill
Copy link
Contributor

I'll go check out their implementation. For the most part our Content class is just a POCO, but I don't mind making it more feature-rich.

The anonymous object above should work for now. We may change it to a dictionary in the future. Let me know if that doesn't work for you though and I'll look into it.

@georgiosd
Copy link
Contributor Author

Sure :)

Thanks!

@georgiosd
Copy link
Contributor Author

We got busted.

CC works like we discussed. For BCC you must add to list of recipients and it doesn't really work like BCC (the TO: address doesn't appear).

Poop.

@georgiosd
Copy link
Contributor Author

Would you kindly merge #20 and updated the nuget?

@georgiosd georgiosd reopened this May 16, 2018
@StrangeWill
Copy link
Contributor

Cool, yeah, give me a moment, I'll get it out today/tomorrow.

@georgiosd
Copy link
Contributor Author

Thank you @StrangeWill !

@StrangeWill
Copy link
Contributor

@georgiosd
Copy link
Contributor Author

You're the man! Thanks

@StrangeWill
Copy link
Contributor

No problem, and thanks for the PR. :D

@georgiosd
Copy link
Contributor Author

Short and sweet :P

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants