trenz-gmbh / TRENZ.Lib.RazorMail

Templated transactional e-mail using Razor
MIT License
2 stars 0 forks source link

Message priority #15

Open ricardoboss opened 5 months ago

ricardoboss commented 5 months ago

It would be nice to be able to send messages with an importance.

MailKit exposes two interfaces for this: https://github.com/jstedfast/MimeKit/blob/master/MimeKit/XMessagePriority.cs

and https://github.com/jstedfast/MimeKit/blob/master/MimeKit/MessagePriority.cs

I'd like to be able to use one API so it sets both of these headers (for legacy support).

chucker commented 5 months ago

Should this also set Importance?

ricardoboss commented 5 months ago

~What's the difference?~

I'm not sure. Ideally we'd be able to set both individually, so the user has the flexibility to set them however they desire.

chucker commented 5 months ago

It seems from https://stackoverflow.com/a/12422845 that, technically, X-Priority and Importance are the ones you're looking for, and Priority, while tangentially related (and perhaps often desired for the same reason), is technically something different.

I.e., if a message is important, we should set X-Priority and Importance. And if it should also be delivered quickly, we should set Priority.

ricardoboss commented 5 months ago

Sounds good.

Now how do we implement that? Should we add two properties to MailTemplateBase?

chucker commented 5 months ago

Hmm. I think MailTemplateBase should only have properties that makes sense to set from the view. Does this make sense as an API?

@{
    Subject = "Greetings, @Model.Salutation!";

    Importance = MailImportance.High;
    Priority = MailPriority.Urgent;
}

(This also overlaps with #14 — I think we want a separate model, replacing MailMessage, where you would set such properties.)