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
585 stars 176 forks source link

Any suggestions on encapsulating MvcMailer in a Factory class? #134

Open kahanu opened 10 years ago

kahanu commented 10 years ago

I need to send out email blasts to the members of my organization, and there are a variety of different blasts I need to send based on different criteria.

I tried encapsulating MvcMailer inside a derived class in a Factory Pattern but I always got the "HttpContext null" exception. I even tried passing the current context in and it still didn't work.

Do you have any suggestions on how to encapsulate MvcMailer in this type of pattern? Of course I would need it to run asynchronously.

Thanks,

King Wilder

smsohan commented 10 years ago

The way it's written, it works with sub classing as opposed to encapsulating.

If you want, you can look at the code and may be change it according to your need.

Thank you


Sent from my iPhone Sohan SM

On May 10, 2014, at 10:47 PM, King Wilder notifications@github.com wrote:

I need to send out email blasts to the members of my organization, and there are a variety of different blasts I need to send based on different criteria.

I tried encapsulating MvcMailer inside a derived class in a Factory Pattern but I always got the "HttpContext null" exception. I even tried passing the current context in and it still didn't work.

Do you have any suggestions on how to encapsulate MvcMailer in this type of pattern? Of course I would need it to run asynchronously.

Thanks,

King Wilder

— Reply to this email directly or view it on GitHubhttps://github.com/smsohan/MvcMailer/issues/134 .

kahanu commented 10 years ago

I have looked at your code. I'll see if I can figure something out.

Thanks,

King Wilder

Sent from my Windows Phone


From: SM Sohanmailto:notifications@github.com Sent: ý5/ý11/ý2014 5:52 AM To: smsohan/MvcMailermailto:MvcMailer@noreply.github.com Cc: King Wildermailto:info@kingwilder.com Subject: Re: [MvcMailer] Any suggestions on encapsulating MvcMailer in a Factory class? (#134)

The way it's written, it works with sub classing as opposed to encapsulating.

If you want, you can look at the code and may be change it according to your need.

Thank you


Sent from my iPhone Sohan SM

On May 10, 2014, at 10:47 PM, King Wilder notifications@github.com wrote:

I need to send out email blasts to the members of my organization, and there are a variety of different blasts I need to send based on different criteria.

I tried encapsulating MvcMailer inside a derived class in a Factory Pattern but I always got the "HttpContext null" exception. I even tried passing the current context in and it still didn't work.

Do you have any suggestions on how to encapsulate MvcMailer in this type of pattern? Of course I would need it to run asynchronously.

Thanks,

King Wilder

— Reply to this email directly or view it on GitHubhttps://github.com/smsohan/MvcMailer/issues/134 .

— Reply to this email directly or view it on GitHubhttps://github.com/smsohan/MvcMailer/issues/134#issuecomment-42769768.