smsohan / MvcMailer

A Mailer for ASP.Net MVC that forms the Email Body using MVC Views (Razor etc.) following Ruby on Rails ActionMailer style
MIT License
582 stars 178 forks source link

Bug in Url.Abs() method #13

Open LeeDumond-duplicate opened 13 years ago

LeeDumond-duplicate commented 13 years ago

This wasn't surprising to discover, as the exact same thing happened to me -- I have a custom method I use that does the same thing, and it also broke in this case. The problem is, when you host on a load-balanced cloud service (like, say, AppHarbor) then the URLs that the method derives have port numbers attached to them. Your Url.Abs() method leaves these port numbers in. The port numbers get carried over to the email URLs, which of course breaks the links. I think the solution would be to strip the port numbers out -- UNLESS the URL is to localhost of course, which would be the case when developing with Cassini or IIS Express. For localhost you'd want to leave the port numbers intact. Hope this helps.

smsohan commented 13 years ago

I guess I will go with a configuration option with URL. This is the approach taken in rails action mailer for the same reason. This way it will be easy for people to get it working under unusual and unit test situation. Stay tuned. A new release is due early May.

On 2011-04-27, at 6:47 PM, LeeDumond reply@reply.github.com wrote:

This wasn't surprising to discover, as the exact same thing happened to me -- I have a custom method I use that does the same thing, and it also broke in this case. The problem is, when you host on a load-balanced cloud service (like, say, AppHarbor) then the URLs that the method derives have port numbers attached to them. Your Url.Abs() method leaves these port numbers in. The port numbers get carried over to the email URLs, which of course breaks the links. I think the solution would be to strip the port numbers out -- UNLESS the URL is to localhost of course, which would be the case when developing with Cassini or IIS Express. For localhost you'd want to leave the port numbers intact. Hope this helps.

Reply to this email directly or view it on GitHub: https://github.com/smsohan/MvcMailer/issues/13

EisenbergEffect commented 12 years ago

Any updates on this. I'm in testing right now with my web app and this caused an immediate issue with my beta testers...none of the links in the emails they got worked. Is it possible to create my own helper for MVC.Mailer? I have simple config variables that let me determine the environment and could easily switch out the base url.