开发者

MvcMailer view in browser

开发者 https://www.devze.com 2023-03-03 09:49 出处:网络
I am using MvcMailer with my website to send html emails. seems good, but im just w开发者_运维问答ondering how i can view the created emails in a browser.

I am using MvcMailer with my website to send html emails. seems good, but im just w开发者_运维问答ondering 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消