I just released a .Net NuGet package called MvcMailer and to get people super easily started, put an article at CodeProject.com. You are most welcome to the article at http://www.codeproject.com/KB/aspnet/MvcMailerNuGet.aspx
I welcome your comments and suggestions!
Hi!
ReplyDeleteThirst of all, thank you for a brilliant package! It's simple and easy to use!
I've just found one little issue - I've notices that the ControllerContext for Notifier doesn't have the RouteData dictionary populated with the same values as the RouteData for main controller. This causes UrlHelper to generate invalid Urls. My app is a multi-tenant one and all my routes have format: /{account}/{controller}/{action}/ I've managed to 'fix' it by adding following code in the WelcomeMessage.cshtml
@{
this.Url.RequestContext.RouteData = (this.Context.CurrentHandler as MvcHandler).RequestContext.RouteData;
}
I wonder if you could fix it properly, then MvcMailer will be just perfect! ;-)
Thank you,
Jakub
Thanks for your suggestion. I will fix this issue this weekend.
ReplyDeleteAwesome!
ReplyDeleteWill you release a new version through NuGet? I will be able to upgrade easily and test it for you.
Cheers!
Jakub
Yes, a new version is overdue now:)
ReplyDeleteGreat! I'm waiting impatiently... ;-)
ReplyDeletePS. Congratulations on joining ThoughtWorks
Can you please share your specific route and ActionLink in mailer view that breaks for the route data?
ReplyDeleteI know a solution to your problem now. But I would like to make sure I know the problem in detail.
My route is defined as:
ReplyDeleteroutes.Add("Account", new Route("{account}/{controller}/{action}/{id}",
new RouteValueDictionary(new { account = "", controller = "Home", action = "Index", id = "" }), new AccountMvcRouteHandler()));
I'm trying to render a link:
href="@Url.Abs(Url.Action("About", "Home"))"
The url that is generated looks like:
http://mysite/Home/About
instead of
http://mysite/myaccount/Home/About
Thanks for your reply. I will test this out before I push a new release. The new release will also add multi-part emails so that you can easily send html and plain text emails.
ReplyDeleteBrilliant! Can't wait. Could you post a comment here or send me a line to jkonecki [at] gmail.com when the new release is out so I can test it as well?
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteJust released 0.8 and it should work. But please let me know if it doesn't.
ReplyDeleteI also added multi-part emails in version 0.8. You may check that out as well.
One important change:
mail.Body = PopulateBody(mail, "welcome") needs to be replaced with PopulateBody(mail, "Welcome"), it gets rid of the duplication