brockallen / BrockAllen.MembershipReboot

MembershipReboot is a user identity management and authentication library.
Other
742 stars 238 forks source link

html formatted emails #554

Closed TheOtherOnes closed 9 years ago

TheOtherOnes commented 9 years ago

I see that html formatted emails are supported but I don't see how to turn it on. Can you point to where the setting is?

brockallen commented 9 years ago

You'd need to really build your own message formatter. The built-in formatting is really there for development/illustration.

TheOtherOnes commented 9 years ago

I've already implemented a CustomEmailMessageFormatter based on your example to handle localized emails. How can I take that to the next level and make them html? Seems like I'd have to customize EmailEventHandler. Is that possible? Can you provide some guidance if that's the way to go?

brockallen commented 9 years ago

Use the SmtpMessageDelivery and set sendAsHtml to true. If you don't want that, then implement your own IMessageDelivery with the EmailEventHandler. If you don't use any of those, then you can just do that yourself in your own event handler.

TheOtherOnes commented 9 years ago

Thank Brock. That was easier than I thought.

var delivery = new SmtpMessageDelivery();
delivery.SendAsHtml = true;
config.AddEventHandler(new EmailAccountEventsHandler<CustomUserAccount>(emailFormatter, delivery));

Now all I have to do it redo all those message bodies :-)