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

Ability to apply a CC address #93

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mcosier
Copy link

@mcosier mcosier commented Mar 17, 2021

Surfacing the commonly used CC field into the PostmarkMessage constructor and SendMessage extensions to make its availability more visible to the developer.

@vladsandu
Copy link
Contributor

@mcosier thank you for submitting this PR!

Note that you can already set the Cc field on a message, via the Object Initialiser, as the field is already present on the model:

var message = new PostmarkMessage
{
    From = "[email protected]",
    To = "[email protected]",
    Cc = "[email protected]",
    Subject = "A complex email",
    HtmlBody = "<html><body>Test Body</body></html>",
    MessageStream = "outbound"
};

That constructor is there for convenience, in order to keep support for that coding style, mostly aimed for simpler scenarios. The models themselves are mutable anyway, so for more complex scenarios that involve providing many optional arguments, currently we recommend using the Object Initialiser style to create request DTOs.

@mcosier
Copy link
Author

mcosier commented Mar 17, 2021

Thanks @vladsandu, my only concern is that lot of people may 'miss' this commonly used field due to the lack of examples in the documentation (for v2) accompanied by its dependence on the type of coding style one uses. Exposing it (at very least) to the extension method(s), or a secondary extension method may increase your uptake - without it being an obvious capability, people may look elsewhere or other ways to interact with the API directly.

I'd be happy to update that v2 documentation for you with a sample if you are interested.

@vladsandu
Copy link
Contributor

@mcosier thank you for your message and I apologise for the delay!

I agree that's a valid concern. I went ahead and updated our wiki examples to include usage of the Cc field.

Regarding adding that field to our extension methods, I'm reluctant about expanding them further just to facilitate initialising optional fields. That extension method has been there for historical reasons, possibly to facilitate transition from older versions of the library. But I'm thinking this type of method can become quite verbose and harder to maintain when working with complex models in the long run.

Going forward, I believe we should prefer and recommend using Object initialisers for populating these complex DTOs.

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.

2 participants