Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Actionmailer.Net.Standalone in a console application?

Is is possible to use Actionmailer.Net.Standalone in a console application? I keep getting an error that:

Could not find any CSHTML or VBHTML views named [CRD.html.cshtml] in the path [EmailTemplates]. Ensure that you specify the format in the file name (ie: CRD.html.cshtml.txt.cshtml or CRD.html.cshtml.html.cshtml)

Code

    public class Mailer : RazorMailerBase
{
    public override string ViewPath
    {
        get { return "EmailTemplates"; }
    }

    public RazorEmailResult Processed(string f)
    {

        From = group;
        To.Add(user);
        Subject = "CRD Process Server has processed file: " + f;
        return Email("CRD.html.cshtml");
    }
}

enter image description here

Do I need to implement a RazorViewEngine somewhere since it isn't standard with a console application?

like image 365
btm86042 Avatar asked Nov 19 '25 18:11

btm86042


1 Answers

A little late but maybe it still helps:

Try to change

return Email("CRD.html.cshtml");

to

return Email("CRD");

The extensions are appenden automatically.

like image 143
hydr Avatar answered Nov 21 '25 07:11

hydr



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!