1

I am using MvcMailer with my website to send html emails. seems good, but im just wondering how i can view the created emails in a browser.

eg in some newsletters they say "view this email in a browser", so i am just wondering how I can do that with MvcMailer.

raklos
  • 28,027
  • 60
  • 183
  • 301

1 Answers1

3

The easiest way is to put a link in the email back to your site, and then create a controller/action that uses the same view, and builds a model the same as the one you used when creating the email.

If all the data you need is in the database, you may be able to just pass a key in the querystring (note: if the mail contains potentially sensitive information, make sure the url is tamper-proof), otherwise you might need to pass in more data to allow you to reconstruct the same view that you did when generating the email.

Danny Tuppeny
  • 40,147
  • 24
  • 151
  • 275
  • Special note about this though - make sure you use a different class for your `preview` controller actions, or it'll blow up. – Doug May 14 '15 at 15:31