-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not getting template/view to show up in message body of e-mail. #23
Comments
With the MVCMailer source code you can debug your mailer and see if Sent from my iPhone S M Sohan On 2011-07-24, at 3:23 PM, remesq
|
Sorry if this issue is not appropriate here. A while back I started using MvcMailer and had great results in my MVC3 project. The e-mails were getting sent AND the body (using _Layout.cshtml and [NameOfMailer].cshtml) were showing up in the sent e-mail.
In the last two months I started checking out OrchardCMS (v 1.2), and, after deciding to use it, started moving my MVC3 project over. This included trying to create a module that utilized MvcMailer.
Now, I got the module in OrchardCMS to send the e-mail, HOWEVER, no body appears in the message of the e-mail. I have spent countless hours trying to figure out why. I attempted getting help on the OrchardCMS forums, but to no avail. Which is why, as a last ditch effort, I turn to you for any guidance. Again, I understand if you are unable to help.
I have tried a bunch of things. I looked at the MvcMailer source and saw how MailerBase.cs was switching the controller temporarily to get the template/views (_Layout.cshtml and [NameOfMailer].cshtml). I continue to get my success page for sending the mail (and see it in my GMail inbox) but the message body is empty, i.e., it's not finding the layout or view. I received no page errors - leading to my confusion and leading me to try everything under the sun to get it to work.
Out of the multitude of variations I tried to get this to work, I stumbled upon using "PopulateHtmlBody" instead of "PopulateBody". This confirmed my suspicion that the e-mail was not receiving the view. This is the error I received using "PopulateHtmlBody":
The view 'QuoteMail' or its master was not found or no view engine supports the searched locations. The following locations were searched:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The view 'QuoteMail' or its master was not found or no view engine supports the searched locations. The following locations were searched:
Source Error:
Line 35: PopulateHtmlBody(mailMessage, "QuoteMail", "_Layout");
Line 36: //PopulateBody(mailMessage, "QuoteMail", resources);
Again, the code I am using works outside of OrchardCMS in my MVC3 project without a problem.
It has something to do with how OrchardCMS treats its views/routing. I created routes in my Route.cs under the module project; I even created a QuoteMail controller in the module project. Nothing works. I thought you might have some insight.
Thanks for any guidance.
The text was updated successfully, but these errors were encountered: