Coder Social home page Coder Social logo

smsohan / mvcmailer Goto Github PK

View Code? Open in Web Editor NEW
584.0 67.0 178.0 12.85 MB

A Mailer for ASP.Net MVC that forms the Email Body using MVC Views (Razor etc.) following Ruby on Rails ActionMailer style

License: MIT License

C# 86.20% PowerShell 10.95% Ruby 2.85%

mvcmailer's Introduction

MvcMailer is an ASP.NET MVC Mailer, inspired by Ruby on Rails ActionMailer, that helps composing Email body using regular ASP.NET MVC views. This one works with .Net 4.0 for now.

##How to Use

See MvcMailer Wiki

##Report Feature or Issues

Use Github Issues Page to mention your desired feature or if something is broken!

##Have Fun

I have a lot of fun working on this project. Wish you enjoy using it and if you wish, you can contribute too. Find me on Twitter @smsohan

Other Contributors

@TylerMercier

mvcmailer's People

Contributors

jamestelfer avatar mmooney avatar mstrater avatar smsohan avatar swegner avatar tylermercier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mvcmailer's Issues

Nuget Instalation

PM> install-package MvcMailer
'T4Scaffolding (≥ 0.9.6)' not installed. Attempting to retrieve dependency from source...
Done
'EFCodeFirst (≥ 0.8)' not installed. Attempting to retrieve dependency from source...
Done
Successfully installed 'EFCodeFirst 0.8'
Successfully installed 'T4Scaffolding 0.9.6'
Successfully installed 'MvcMailer 0.9'
Successfully added 'EFCodeFirst 0.8' to Common
Successfully added 'T4Scaffolding 0.9.6' to Common
Successfully added 'MvcMailer 0.9' to Common

I'm confused by the Nuget installer. What are these installs. I don't see any assemblies other than the mvcmailer.dll. Most importantly is how will this affect deployment? Do I only need the mvcmailer.dll in my bin?

Thank you

Geting encoding problem only when I use linkedResources

Hi,
I have used your mvcmailer application which is fantastic, in my "contact us" form. the only problem is when I use linkedResources in populateBody method, the email will be unreadable it contains strange characters. when i remove linkedResources in the method I get the email as it is.
I need to use dictionary<string, string> as LinkedResources in populateBody method to show our logo. any advice ? thank you.
here is the code
mailMessage.To.Add("[email protected]");
ViewData = new ViewDataDictionary(c);
mailMessage.BodyEncoding = System.Text.Encoding.UTF8;

        PopulateBody(mailMessage, viewName: "ContactUs", linkedResources: resources);

Save HTML to be view in Browser

I love MvcMailer, but was wondering what the best way to save the rendered email down to a database is. I'd like to essentially cache what was generated so that if a user wants to view the email in a web browser they could do so. Are there any hooks in MvcMailer to do that?

Thanks,

Khalid

Sending email from Azure

How can I use MvcMailer in Azure since Azure doesn't support smtp? I am planning to use 3rd party api to send email so is there a way to extend UserMailer.Welcome().ToHTML or .ToText to return View Result so that I can pass it to the 3rd party body method?

3rdPartyMailApi.body = UserMailer.Welcome().ToHTML

Thanks
Wil

Not getting .Send() and .SendAsync() extension methods?

I just installed MvcMailer via Nuget and I do not get the extension methods to send mail.

When I type this UserMail.Welcome(). I see a bunch of properties like attachments, sender, etc. But no Send or SendAsync

Am I missing something. The Nuget install worked fine with no errors. Using Mvc3 with VS 2010.

Thank you.

MvcMailer FileLoadExcpetion in MVC4

When using MvcMailer in the Cloud and publishing the package the state of the publish stays in cycling.
The Solution is created with MVC4. After numerous attemps intellitrace noted that it could not find / load System.Web.Mvc version 3.

After troubleshooting all included nuget packeges in the solution we commented all MvcMailer specific code (its base class and implementation). At this point the application can be hosted in the cloud with MVC4 but without the MvcMailer :-(

My question is do you reference explicitly to System.Web.Mvc version 3 in your code? If so can you change this so MvcMailer can be used with MVC4?

Steps to reproduce:

  1. Create new MVC 4 beta project
  2. Add nuget package Mvc Mailer. Optional: update the default packages or add other packages.
  3. Project won’t run properly because the web.config in the Views folder has double config sections so comment them:
  1. Add class that implements te base class for the mvc mailer:
    public class TestMailer : MailerBase
    {
    public TestMailer(): base()
    {
    MasterName="_Layout";
    }
    }
  2. Publish to Azure with default settings. The state in Visual Studio 2010 will stay in Cycle. The intellitrace log file says: System.TypeLoadException. Could not load file or assembly MVC version 3.

Problem embedding resource

Without embedding resource, it I can send out emails just fine. However, if I were to try the following:

PopulateBody(mailMessage, viewName: "ResetPassword", linkedResources: resources);

I get error Could not find a part of the path. I have set "/Content/images/logo.png" as my path but it points to 'C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0\Content\images\logo.png' instead. Any idea how I could get this going?

Allow Views with Models

You may not consider this an "issue" but seeing how MvcMailer is all about MVC, i think not having a model in the view is an "issue". Relying on Viewbag is cool, but why not really follow the MVC pattern?

Would love to have my razor views setup a model type so that I can pass the model into the view using PopulateBody();

This should be possible:
var model = new ModelView(); model.FirstName = "Hello"; model.LastName = "World"; PopulateBody(mailMessage, "RazorView", model);

so that in RazorView.cshtml
@model MyModelView This is a @Model.FirstName @Model.LastName app!

MailMessage.Body vs. MailMessage.AlternateViews

Thanks for this great project!

It now works great, but I had some problems getting it to work because the MailMessage returned by PopulateBody actually doesn't set the value MailMessage.Body, but instead adds one or two (in the case of multipart) MailMessage.AlternateViews.

That apparently isn't a problem for sending mail using the standard SmtpClient, but in our project we are using Postmark (http://developer.postmarkapp.com/) and the Postmark .NET library by Daniel Crenna to send e-mail.

For this I have to convert a MailMessage to a PostmarkDotNet.PostmarkMessage. That's where I had a problem: the MailMessage.Body was always empty!

It wasn't until I went into your source code that I discovered that the value of MailMessage.Body is actually never set. I wasn't expecting that. I think it make more sense to always set the Body, and provide an AlternateView when needed.

I case anybody else has this problem - here's the code to retrieve strings from the AlternateViews:

var stream = mailMessage.AlternateViews[0].ContentStream;
using (StreamReader reader = new StreamReader(stream))
{
message.TextBody = reader.ReadToEnd();
}
stream = mailMessage.AlternateViews[1].ContentStream;
using (StreamReader reader = new StreamReader(stream))
{
message.HtmlBody = reader.ReadToEnd();
}

extra . being added to email

I have a cshtml view thats pretty basic.

Dear @ViewBag.User.Name,

We appreciate your interest in the app. Your information has been recieved but you have not been granted access. You will receive an email from an administrator with further instructions.

Your user name is: @ViewBag.User.email

Thank you for your patience,

The email sent has two periods on the end of instructions. Thoughts?

It doesn't mess with the period after app either just the one after instructions.

Issue using MVCMailer with webforms

Have an MVC project that uses a few webforms in it - we are in the process of converting them over. One of the pages happens to render a report. I'm trying to add the ability to email the report if the user wants to. When trying to use MvcMailer to achieve this it seems that it cannot find the view when I try to make the "PopulateBody" call

Here is my code from the UserMailer class

public class UserMailer : MailerBase, IUserMailer
{
///

/// Email Reports using this method
/// </summary>


/// <param name="toAddress">The address to send to.</param>
/// <param name="viewName">The name of the view.</param>
/// <returns>The mail message</returns>
public MailMessage SendReport(string toAddress, string viewName)
{
    var message = new MailMessage { Subject = "Report Mail" };
    message.To.Add(toAddress);
    ViewBag.Name = "Testing-123";

    this.PopulateBody(mailMessage: message, viewName: "SendReport");

    return message;
}

}

Every time I hit the populateBody call it responds with "Value cannot be null. Parameter name: routeData"

Any suggestions to overcome this would be quite helpful.

Scaffold Mailer error....

When using the scaffold command I get the following error,
I'm using on a fresh C# project with both web application and MVC 3.0

PM> Scaffold Mailer UserMailer PasswordReset, PasswordNew
Invoke-Scaffolder : A positional parameter cannot be found that accepts argument 'UserMailer'.
At line:1 char:9

  • Scaffold <<<< Mailer UserMailer PasswordReset, PasswordNew
    • CategoryInfo : InvalidArgument: (:) [Invoke-Scaffolder], ParameterBindingException
    • FullyQualifiedErrorId : PositionalParameterNotFound,T4Scaffolding.Cmdlets.InvokeScaffolderCmdlet

Thanks in advance

Errors when running Scaffold Mailer UserMailer Welcome

Find-ScaffolderTemplate : Could not find template 'cs\IMailerTemplate.vb.t4' below folders ['E:....\packages\MvcMailer.1.1\tools']
At E:....\packages\MvcMailer.1.1\tools\MailerFunctions.ps1:19 char:41

  • $templateFile = Find-ScaffolderTemplate <<<<  cs\$MailerTemplate -TemplateFolders $TemplateFolders -Project $Project -CodeLanguage $CodeLanguage -ErrorIfNotFound
    
    • CategoryInfo : NotSpecified: (:) [Find-ScaffolderTemplate], Exception
    • FullyQualifiedErrorId : T4Scaffolding.Cmdlets.FindScaffolderTemplateCmdlet

Pass a Model to View

There doesnt seem to be a way to pass a model to the View, it seems I can only use and call an empty View and pass date through using ViewBag?

An asynchronous operation cannot be started at this time

Hi, when i want send mail Async in my controller with SendAsync method i get to this error:

System.InvalidOperationException
An asynchronous operation cannot be started at this time. Asynchronous operations may only be started within an asynchronous handler or module or during certain events in the Page lifecycle. If this exception occurred while executing a Page, ensure that the Page is marked <%@ Page Async="true" %>.

i use MVC4.

why?

Encoding of UTF-8 content

I'm running into an encoding issue - Utf-8 text is the mail message is improperly encoded. So far, I've done the following:

  • Saved the mailer's View.text.cshtml as utf-8 (initial version was ANSI)
  • configured the MailMessage (in the MailerBase-derived class) with BodyEncoding and SubjectEncoding both set to Encoding.UTF8
  • pass some utf-8 text via the ViewBag

But the only way to get the text to render correctly in the mail message is if I use:

@Html.Raw(ViewBag.MyUtf8Property)

rather than:

@ViewBag.MyUtf8Property

This seems counter-intuitive to me, but I'm still in need of at least one more coffee today. Any ideas?

Bug in Url.Abs() method

This wasn't surprising to discover, as the exact same thing happened to me -- I have a custom method I use that does the same thing, and it also broke in this case.
The problem is, when you host on a load-balanced cloud service (like, say, AppHarbor) then the URLs that the method derives have port numbers attached to them. Your Url.Abs() method leaves these port numbers in. The port numbers get carried over to the email URLs, which of course breaks the links.
I think the solution would be to strip the port numbers out -- UNLESS the URL is to localhost of course, which would be the case when developing with Cassini or IIS Express. For localhost you'd want to leave the port numbers intact.
Hope this helps.

Using MvcMailer with a service layer?

Hi

I am very interested in using your library as I think it is cool that I could use views to make good looking emails.

I however don't know how to use it with a service layer. I currently have 2 projects one with my mvc 3 code and one for my repos and service layers.

Right now I need to do this. Controller extracts ViewModel data and passes it to service layer. Service layer does some business logic and depending on what options where chosen sends a email.

I want to send the email but use MvcMailer. However that probably would mean I need to add a reference to MVC in my service layer project. I do not want to do this as I think the service layer and repos should know nothing about MVC. I do this with my VM and use automapper and map them to a domain object and send it to the service layers as I don't want to have selectLists or MVC depended code coming along.

How could I use MvcMailer and still respect the boundaries of the service layer?

Thanks

Why is MvcMailer give intermittent NullReferenceException Errors?

On StackOverflow as well: http://goo.gl/sZXoS

I am using MvcMailer via Nuget to try and send Emails using the MVC Views and Models system. I am also using Sharp Architecture so I have my Domain Objects, Infrustructure, Presentation, Tests and Tasks in different projects within the solution.

I created my IClientMailer interface and ClientMailer class in the Presentation project and am able to create the mail message and call EmailBody(ViewName, EmailBoilerplate) method on the MvcMailer's MailerBase class, but the odd thing is that sometime it works and sometimes it gives me the below error. I do not understand why I am only getting this error some of the time and I cannot seem to find how to debug the project more to find out more information.

Anyone have any thoughts on how to get it to work correctly 100% of the time.

[NullReferenceException: Object reference not set to an instance of an object.]
Mvc.Mailer.StringResult.ExecuteResult(ControllerContext context, String mailerName) +142
Mvc.Mailer.MailerBase.EmailBody(String viewName, String masterName) +181
EasyOptions.Web.Mvc.Code.ClientMailer.FirstPaymentCoupon(String[] emailAddresses, FirstPaymentCouponEmailViewModel model) in C:\Users\Gabriel\Documents\Repositories\EasyOptions\Solutions\EasyOptions.Web.Mvc\Code\ClientMailer.cs:53
EasyOptions.Web.Mvc.Controllers.FirstPaymentCouponController.SendEmail(Int64 loanId, FirstPaymentCouponViewModel model) in C:\Users\Gabriel\Documents\Repositories\EasyOptions\Solutions\EasyOptions.Web.Mvc\Controllers\FirstPaymentCouponController.cs:64
lambda_method(Closure , ControllerBase , Object[] ) +166
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +208 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) +27
System.Web.Mvc.<>c__DisplayClass15.b__12() +55
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func1 continuation) +263 System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +19 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func1 continuation) +263
System.Web.Mvc.<>c__DisplayClass17.b__14() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList1 filters, ActionDescriptor actionDescriptor, IDictionary2 parameters) +191
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343
System.Web.Mvc.Controller.ExecuteCore() +116
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
System.Web.Mvc.<>c__DisplayClassb.b__5() +37
System.Web.Mvc.Async.<>c__DisplayClass1.b__0() +21
System.Web.Mvc.Async.<>c__DisplayClass81.<BeginSynchronous>b__7(IAsyncResult _) +12 System.Web.Mvc.Async.WrappedAsyncResult1.End() +62
System.Web.Mvc.<>c__DisplayClasse.b__d() +50
System.Web.Mvc.SecurityUtil.b__0(Action f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8963149
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

Install error and no Mvc.Mailer reference

I installed the package as instructed but at the end of it there's an error and no Mvc.Mailer reference is added to project but I was able to scaffold my mailers.

++++++++
install-package MvcMailer
Tentando resolver dependência 'T4Scaffolding (≥ 0.9.7)'.
Tentando resolver dependência 'EntityFramework (≥ 4.1.10311.0)'.
Você está baixando EntityFramework de Microsoft, para o qual o contrato de licença está disponível em http://go.microsoft.com/fwlink/?LinkId=224682. Verifique o pacote quanto a dependências adicionais, as quais podem vir com seu(s) próprio(s) contrato(s) de licença. Ao usar o pacote e suas dependências você concorda com os termos dos contratos de licença. Se você não concorda com os termos do(s) contrato(s) de licença, exclua os componentes relevantes do seu dispositivo.
'EntityFramework 4.1.10715.0' instalado com êxito.
Êxito ao remover 'EntityFramework 4.1.10331.0' de SiteArteCultura.
Êxito ao adicionar 'EntityFramework 4.1.10715.0' a SiteArteCultura.
'T4Scaffolding 0.9.9' instalado com êxito.
A different version of T4Scaffolding is already running in this instance of Visual Studio
Please restart Visual Studio to avoid unexpected behavior

Êxito ao adicionar 'T4Scaffolding 0.9.9' a SiteArteCultura.

Warning: A different version of T4Scaffolding is already running in this instance of Visual Studio, so installation cannot be completed at this time.

You must restart Visual Studio and then install the desired package again. Now rolling back package installation.

Êxito ao remover 'T4Scaffolding 0.9.9' de SiteArteCultura.
'T4Scaffolding 0.9.9' instalado com êxito.

'T4Scaffolding 0.9.9' instalado com êxito.
'EntityFramework 4.1.10715.0' instalado com êxito.
Falha na instalação. Revertendo...
Install-Package : Installation cannot proceed until you have restarted Visual Studio.
Em linha:1 caractere:16

  • install-package <<<< MvcMailer
    • CategoryInfo : NotSpecified: (:) [Install-Package], RuntimeException
    • FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

++++++++

msg.Send() method

I was wondering if it wouldn't be better moving the Send() extension method out of the Mvc.Mailer namespace into the Web.Mailers namespace.

That way your code behind files only need one using statement.
Its a small change, but it took me ages to find the namespace for the send method.

Like I said, just a suggestion.
Thanks for an awesome project

SendAsnyc not working

Send() works great, but the page hangs while it tries to connect to the mail server. However, when I try SendAsynch(), it does not throw any errors, but I never receive the email.

Feature Request: _MailViewStart.cshtml

I want something very simple: share layouts between mailers!
Right now the only elegant way I found is
@{
Layout = "~/Views/EmailLayouts/_Layout.cshtml";
}

At the beginning of each Email view. (Please tell me I'm wrong!)
There ain't any real way to have a default Email layout.
The Best way I can think is to have a _MailViewStart.cshtml together with the new _ViewStart.cshtml

Thanks for the lovely work!

Regards,

godaddy - Security Exception when embedded image inlined

I've got this error on godaddy hosting, only. It works correct on my internal server.
I've created simple template with three images included as described on https://github.com/smsohan/MvcMailer/wiki/MvcMailer-Step-by-Step-Guide

But it seems that Godaddy has strong security restriction and
this call

Mvc.Mailer.LinkedResourceProvider.GetContentType(String fileName) +53

wan't work…

Security Exception
Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.RegistryPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SecurityException: Request for the permission of type 'System.Security.Permissions.RegistryPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
   System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
   System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark& stackMark) +31
   System.Security.CodeAccessPermission.Demand() +46
   Microsoft.Win32.RegistryKey.CheckPermission(RegistryInternalCheck check, String item, Boolean subKeyWritable, RegistryKeyPermissionCheck subKeyCheck) +9629642
   Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +70
   Microsoft.Win32.RegistryKey.OpenSubKey(String name) +6
   Mvc.Mailer.LinkedResourceProvider.GetContentType(String fileName) +53
   Mvc.Mailer.LinkedResourceProvider.Get(String contentId, String filePath) +34
   Mvc.Mailer.LinkedResourceProvider.GetAll(Dictionary`2 resources) +168
   Mvc.Mailer.MailerBase.PopulateLinkedResources(AlternateView mailPart, Dictionary`2 resources) +101
   Mvc.Mailer.MailerBase.PopulateHtmlPart(MailMessage mailMessage, String viewName, String masterName, Dictionary`2 linkedResources) +48
   Mvc.Mailer.MailerBase.PopulateBody(MailMessage mailMessage, String viewName, String masterName, Dictionary`2 linkedResources) +160
   Mvc.Mailer.MailerBase.PopulateBody(MailMessage mailMessage, String viewName, Dictionary`2 linkedResources) +18
   Navtran.Web.WebSite.Mailers.UserMailer.UserInvitation(UserInvitation userInvitation) in UserMailer.cs:46
   WebSite.Controllers.UserAccountController.SendInvitation(UserInvitation userInvitation) in UserAccountController.cs:71
   lambda_method(Closure , ControllerBase , Object[] ) +86
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +188
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
   System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +56
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +267
   System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +20
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +190
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +329
   System.Web.Mvc.Controller.ExecuteCore() +115
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +94
   System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
   System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
   System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
   System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +31
   System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
   System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +23
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +59
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8897857
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1 

Install Errors

on installation from within a brand new MVC3 C# project, I get the following errors:

PM> install-package MvcMailer
Attempting to resolve dependency 'T4Scaffolding (≥ 0.9.7)'.
Attempting to resolve dependency 'EntityFramework (≥ 4.1.10311.0)'.
You are downloading EntityFramework from Microsoft, the license agreement to which is available at http://go.microsoft.com/fwlink/?LinkId=224682. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
Successfully installed 'EntityFramework 4.1.10715.0'.
Successfully installed 'T4Scaffolding 0.9.9'.
Successfully installed 'MvcMailer 1.1'.
Successfully removed 'EntityFramework 4.1.10331.0' from MvcApplication2.
Successfully added 'EntityFramework 4.1.10715.0' to MvcApplication2.
Successfully added 'T4Scaffolding 0.9.9' to MvcApplication2.
Set-DefaultScaffolder : Unable to cast object of type 'NuGet.SemanticVersion' to type 'System.Version'.
At C:\users\rwhitmire\documents\visual studio 2010\Projects\MvcApplication2\packages\T4Scaffolding.0.9.9\tools\install.ps1:22 char:22

  • Set-DefaultScaffolder <<<< -Name DbContext -Scaffolder T4Scaffolding.EFDbContext -SolutionWide -DoNotOverwriteExistingSetting
    • CategoryInfo : NotSpecified: (:) [Set-DefaultScaffolder], InvalidCastException
    • FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Set-DefaultScaffolder : Unable to cast object of type 'NuGet.SemanticVersion' to type 'System.Version'.
At C:\users\rwhitmire\documents\visual studio 2010\Projects\MvcApplication2\packages\T4Scaffolding.0.9.9\tools\install.ps1:23 char:22

  • Set-DefaultScaffolder <<<< -Name Repository -Scaffolder T4Scaffolding.EFRepository -SolutionWide -DoNotOverwriteExistingSetting
    • CategoryInfo : NotSpecified: (:) [Set-DefaultScaffolder], InvalidCastException
    • FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Set-DefaultScaffolder : Unable to cast object of type 'NuGet.SemanticVersion' to type 'System.Version'.
At C:\users\rwhitmire\documents\visual studio 2010\Projects\MvcApplication2\packages\T4Scaffolding.0.9.9\tools\install.ps1:24 char:22

  • Set-DefaultScaffolder <<<< -Name CustomTemplate -Scaffolder T4Scaffolding.CustomTemplate -SolutionWide -DoNotOverwriteExistingSetting
    • CategoryInfo : NotSpecified: (:) [Set-DefaultScaffolder], InvalidCastException
    • FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Set-DefaultScaffolder : Unable to cast object of type 'NuGet.SemanticVersion' to type 'System.Version'.
At C:\users\rwhitmire\documents\visual studio 2010\Projects\MvcApplication2\packages\T4Scaffolding.0.9.9\tools\install.ps1:25 char:22

  • Set-DefaultScaffolder <<<< -Name CustomScaffolder -Scaffolder T4Scaffolding.CustomScaffolder -SolutionWide -DoNotOverwriteExistingSetting
    • CategoryInfo : NotSpecified: (:) [Set-DefaultScaffolder], InvalidCastException
    • FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Successfully added 'MvcMailer 1.1' to MvcApplication2.
Set-DefaultScaffolder : Unable to cast object of type 'NuGet.SemanticVersion' to type 'System.Version'.
At C:\users\rwhitmire\documents\visual studio 2010\Projects\MvcApplication2\packages\MvcMailer.1.1\tools\install.ps1:23 char:22

  • Set-DefaultScaffolder <<<< -Name Mailer -Scaffolder $mailerScaffolder -SolutionWide -DoNotOverwriteExistingSetting
    • CategoryInfo : NotSpecified: (:) [Set-DefaultScaffolder], InvalidCastException
    • FullyQualifiedErrorId : T4Scaffolding.Cmdlets.SetDefaultScaffolderCmdlet

Remove dependency on EF

Hi,

first I want to say great job this project, gives me exactly what I'm looking for.

I dont see why though do we need EF to run any of this, is it possible to remove the dependency?

Why the reference to EF?

First of all I just want to say thanks for creating this great little framework, I've previously used MonoRail which comes with something similar and I've always thought this was missing from MVC.

I just wondered why the nuget has a dependancy on Entity Framework? It's not really a problem but I'm not using EF in the rest of my application and the OCD part of me would prefer there not to be a reference.

Cheers,

Adam.

Installing MvcMailer corrupts CodedUI tests

When MvcMailer is installed via NuGet it is no longer possible to edit UIMaps for CodedUI testing which means it's no longer possible to generate code for new tests. I see the same issue on another computer that has retrieved the code from the source control. When trying to open UIMap or create a new test with Test builder this message pops up:

The following package failed to load:
C:\Users\[username]\AppData\Local\assembly\dl3\13YH5408.B6N\D995C8N6.CK1\02143ec0\004bcc37_c67fcd01\Microsoft.VisualStudio.TestTools.UITest.Extension.IE.dll.

It is always the same path even on different projects even though it looks like a random cache path. I have deleted the folders manually but they are recreated. Have not been able to check the path on other computers though. So far I have not encountered this issue when installing anything else, that is why I suspect MvcMailer to be the cause. Perhaps it has something to do with T4Scaffolding? However installing that seperately does not cause this behaviour.

Steps to reproduce:

  1. Create a new MVC 3 project (Internet, aspx)
  2. Add a new project -> Test -> Test project
  3. Add Coded UI test to test project
  4. Generate some UI test with Coded UI test builder
  5. Now it should be possible to open the UIMap.uitest with Coded UI test Editor
  6. Install-Package MvcMailer
  7. Close down the entire solution (not sure this is required)
  8. Open the UIMap.uitest with Coded UI test Editor and you should get the error stated above.

If MvcMailer is uninstalled then it is possible to open the UIMap again (restart of VS might be required).

A workaround to enable editing uf UIMap again is to unload the MVC project and restart VS, then it is possible to generate code for tests again.

System:
Win7 x64 EN, VS2010 SP1 Ultimate, ASP.NET MVC 3 Tools Update

Config Problems with MVC 4

Hi,

The MvcMailer NuGet package messes up the Web.config for Views in a MVC 4 beta Internet Application.

Steps to reproduce:

  • create a default template MVC 4 Internet Application
  • install MvcMailer: install-package MvcMailer
  • update Scaffolding as per http://stackoverflow.com/questions/10241797/error-scaffolding-with-mvcmailer-in-mvc-4 : update-package T4Scaffolding (the other command would not even run for me Update-Package MvcScaffolding)
  • restart VS
  • the View's Web.config contains duplicate entries referencing Razor 3.0 libraries. Since there are references to Razor 4.0 libraries, the app stops working.

Resolution:
remove the redundant references to 3.0 libraries

Not getting template/view to show up in message body of e-mail.

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.

Linked resource and MemoryStream

Your function generating the attachement is taking the path to the file as a parameter. However, I am trying to include an image in the email that is saved in MemoryStream and not as a file.

Instead of only taking the path as linked resource, I created a patch to enable the function to use the MemoryStream too.

I think this is useful addition to your code, maybe you could include it in the next release ?

Here it is on stackoverflow :

http://stackoverflow.com/questions/8789425/using-mvcmailer-to-embed-image-from-memorystream-in-email

Let me know what you think.

ArgumentReferenceException or NullReferenceException when running in AsyncController

Hello,

I'm encountering some serious problems when running MvcMailer in a AsyncController. Here's the code :

public void IndexAsync()
{
AsyncManager.OutstandingOperations.Increment();

     Action sendMailHandler = SendChangePasswordEmail;
     sendMailHandler.BeginInvoke(ar => SendChangePasswordEmail(), sendMailHandler); Glimps.MVC3 crashes IIS

}

private void SendChangePasswordEmail()
{
var mailer = new PasswordMailer();
var msg = mailer.ForgotPassword();
msg.Send();
AsyncManager.OutstandingOperations.Decrement();
}

It crashes on line var msg = mailer.ForgotPassword(); with the following stack trace :

Informations sur l'exception : System.ArgumentNullException
Pile :
à System.Web.Routing.RouteCollection.GetRouteData(System.Web.HttpContextBase)
à Mvc.Mailer.MailerBase.CreateControllerContext()
à Mvc.Mailer.MailerBase.ViewExists(System.String, System.String)
à Mvc.Mailer.MailerBase.TextViewExists(System.String, System.String)
à Mvc.Mailer.MailerBase.PopulateBody(System.Net.Mail.MailMessage, System.String, System.String, System.Collections.Generic.Dictionary`2<System.String,System.String>)
à Jaskula.CvMedia.UI.Mailers.PasswordMailer.ForgotPassword()
à Jaskula.CvMedia.UI.Areas.Login.Controllers.SendEmailController.SendChangePasswordEmail()
à Jaskula.CvMedia.UI.Areas.Login.Controllers.SendEmailController.b__0(System.IAsyncResult)
à System.Runtime.Remoting.Messaging.AsyncResult.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage)
à System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Messaging.IMessageSink)
à System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem.DoAsyncCall()
à System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem.ThreadPoolCallBack(System.Object)
à System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(System.Object)
à System.Threading.ExecutionContext.runTryCode(System.Object)
à System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object)
à System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
à System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
à System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
à System.Threading.ThreadPoolWorkQueue.Dispatch()
à System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

After providing the CurrentHttpContext i still have a nullReferenceException :

Informations sur l'exception : System.NullReferenceException
Pile :
à Glimpse.Mvc3.Plumbing.GlimpseViewEngine.Process(System.Web.Mvc.ViewEngineResult, Boolean, System.String, System.String, Boolean)
à Glimpse.Mvc3.Plumbing.GlimpseViewEngine.FindView(System.Web.Mvc.ControllerContext, System.String, System.String, Boolean)
à System.Web.Mvc.ViewEngineCollection+<>c__DisplayClassc.b__a(System.Web.Mvc.IViewEngine)
à System.Web.Mvc.ViewEngineCollection.Find(System.Func2<System.Web.Mvc.IViewEngine,System.Web.Mvc.ViewEngineResult>, Boolean) à System.Web.Mvc.ViewEngineCollection.FindView(System.Web.Mvc.ControllerContext, System.String, System.String) à Mvc.Mailer.MailerBase.ViewExists(System.String, System.String) à Mvc.Mailer.MailerBase.TextViewExists(System.String, System.String) à Mvc.Mailer.MailerBase.PopulateBody(System.Net.Mail.MailMessage, System.String, System.String, System.Collections.Generic.Dictionary2<System.String,System.String>)
à Jaskula.CvMedia.UI.Mailers.PasswordMailer.ForgotPassword()
à Jaskula.CvMedia.UI.Areas.Login.Controllers.SendEmailController.SendChangePasswordEmail()
à Jaskula.CvMedia.UI.Areas.Login.Controllers.SendEmailController.b__0(System.IAsyncResult)
à System.Runtime.Remoting.Messaging.AsyncResult.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage)
à System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Messaging.IMessageSink)
à System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem.DoAsyncCall()
à System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem.ThreadPoolCallBack(System.Object)
à System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(System.Object)
à System.Threading.ExecutionContext.runTryCode(System.Object)
à System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object)
à System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
à System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
à System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
à System.Threading.ThreadPoolWorkQueue.Dispatch()
à System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

Any hints what's going wrong ?

Thanks in advance.

Value does not fall within the expected range.

Hello

I'm trying to include MVC Mailer into our project and I'm getting this exception "Value does not fall within the expected range." when the code hits PopulateBody function call.

I don't think I'm doing anything special. Here's the call from controller:

    _userMailer.PasswordReset().SendAsync();

Here's the Welcome function:

    public virtual MailMessage UserWelcome(Profile profile)
    {
        var mailMessage = new MailMessage{ Subject = "Welcome!" };

        mailMessage.To.Add(profile.EmailAddress);
        PopulateBody(mailMessage, viewName: "UserWelcome");

        return mailMessage;
    }

I suspect the exception is thrown because the controller context is not valid at the time of the call and this is caused because I'm running the app locally on Azure service emulator - but I'm not really sure.
Any idea if this is the case and how this could be fixed - or what else coud it be?

Many thanks in advance.

Pass Record ID to MvcMailer

Great framework and easy for a beginner like myself to implement.

However I have problems when I am trying to pass a record id to the mail view.

I am wanting to use MvcMailer to email a view of a new record (Code below). Can you example this scenerio? I can understand if this request is outside the remit of this forum.

[HttpPost]
public ActionResult Index(Form Form)
{
if (ModelState.IsValid)
{
storeDB.Forms.Add(Form);
storeDB.SaveChanges();

// get id
int newID = Form.ID;

var forms = from r in storeDB.Forms
            orderby r.FORMNAMEID, r.DateAction ascending
            where r.ID == newID
            select r

UserMailer.Welcome().Send(); 
//return RedirectToAction("Index");
return View("Successful");

}

Kind regards

Andrew

Using MvcMailer from a WCF service

Hello, I wanted to use MvcMailer from a WCF service, and found only a small modification to MvcMailer helped this along dramatically. I wanted to share it with you, as I do not have an easy way to submit my changes.

WCF services have access to an HttpContext when aspNetCompatibilityEnabled="true" in the Web.config and the following attribute is added to the service class:

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]

After that, the only issue with MvcMailer is that it wanted to have a routing table for the ControllerContext constructor. Rather than try to fake this, we can use a different ControllerConext constructor which only requires an HttpRequest and the ControllerBase.

So if you modify the MailerBase.CreateControllerContext() method as such, you can then use MvcMailer in an WCF service.

private ControllerContext CreateControllerContext()
{
    ControllerContext = new ControllerContext(CurrentHttpContext.Request.RequestContext, this);
    return ControllerContext;
}

There doesn't seem to be any drawbacks to using this alternative constructor, since MvcMailer doesn't use the routing table anyway.

I'd like to see this worked into a future release since it solves some issues with using MvcMailer and WCF (which really is a great way to separate your email from your project!).

Thanks

MVC Areas and _Layout Issue

I am using MVC areas for my administration. When I send an email from a controller in the admin area, it uses the _Layout.cshtml from the admin area, rather than the _Layout.cshtml in the Views\UserMailer folder. Even if I specify the Layout in the view like below, it still uses the _Layout in the admin area.

@{
Layout = "~/Views/UserMailer/_Layout.cshtml";
}

NuGet package MvcMailer3 Not Complete

Created a default MvcApplication project template and added the MvCMailer NuGet package.

The Mailer classes have a compiler error:

Error 8 The type or namespace name 'MvcMailMessage' could not be found (are you missing a using directive or an assembly reference?)

There is reference to the MvcMailer.dll classes in the project. The NuGet package is not installing the compiled assemblies.

Mvc Mailer in area

In my project i wan't to use MvcMailer, it's really nice.
For the structure of my project i wan't to put the mailer controllers + views in a separate area. But after i have done this the
e-mail body stay's empty, so the PopulateBody method can't find the view, i think he is looking in the root view folder instead of the area view folder.
Is is possible to use Mvc Mailer in a separate area?

Path error from install.ps1

PM> install-package MvcMailer
'T4Scaffolding (≥ 0.9.7)' not installed. Attempting to retrieve dependency from source...
Done.
'EntityFramework (≥ 4.1.10311.0)' not installed. Attempting to retrieve dependency from source...
Done.
You are downloading EntityFramework from Microsoft, the license agreement to which is available at http://go.microsoft.com/fwlink/?LinkID=211010. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
Successfully installed 'EntityFramework 4.1.10331.0'.
Successfully installed 'T4Scaffolding 0.9.9'.
Successfully installed 'MvcMailer 1.1'.
Successfully added 'EntityFramework 4.1.10331.0' to Web.
Successfully added 'T4Scaffolding 0.9.9' to Web.
Successfully added 'MvcMailer 1.1' to Web.
Exception calling "EnumerateFiles" with "3" argument(s): "The path is not of a legal form."
At C:\Code\MyStory\MyStory\packages\MvcMailer.1.1\tools\install.ps1:8 char:45

  •     | %{ [System.IO.Directory]::EnumerateFiles <<<< ($_, "*." + $extension, [System.IO.SearchOption]::AllDirectories) }
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : DotNetMethodException

---------------------------READ ME---------------------------------------------------

Your default Mailer Scaffolder is set to Mailer.Razor

You can generate your Mailers and Views using the following Scaffolder Command

PM> Scaffold Mailer UserMailer Welcome,GoodBye

Edit the smtp configuration at web.config file before you send an email

You can find more at: https://github.com/smsohan/MvcMailer/wiki/MvcMailer-Step-by-Step-Guide


No Body Rendered in Email

Hi,

I have got this working correctly in one project where I keep everything together. In the second I created a separate project which I scaffolded the mailers in and created a class which is called from my main controller. It does not raise any errors using PopulateBody(mailMessage, viewName: "CreateNbus"); and it generates an email however the body is empty (other dynamic data is fine). I am writing the email file to disk.

I tried dropping out the master line in the class per another post but this didn't work. I also tried PopulateHtmlBody(mailMessage, "CreateNbus", "_Layout"); but this resulted in an error message about not finding the view. I wondered whether this is the underlying issue?? I note in another post it talked about name conflicts so I renamed the view and references to it to something more obscure than 'create'.

The only other thing I am doing which I didn't do on the standalone was to pass in data to the mailer so I could use dynamic data. This is causing problems with debugging as it raises an exception due to another process being already connected to it. Is there anything to write out to a log to assist?

Any ideas would be appreciated. If anymore details are needed then please shout.

Steve.

Error Scaffolding at Invoke-ScaffoldTemplate

I get an error after the mailers are created. Here is the output from Scaffold Mailer UserMailer Welcome,PasswordReset:

PM> Scaffold Mailer UserMailer Welcome,PasswordReset
Mailers\IUserMailer.cs already exists! Pass -Force to overwrite. Skipping...
Mailers\UserMailer.cs already exists! Pass -Force to overwrite. Skipping...
Invoke-ScaffoldTemplate : Error HRESULT E_FAIL has been returned from a call to a COM component.
At C:\repos\operations\packages\MvcMailer.1.1\tools\MailerFunctions.ps1:54 char:39

  •     $wroteFile = Invoke-ScaffoldTemplate <<<<  -Template $templateFile -Model @{
    
    • CategoryInfo : NotSpecified: (:) [Invoke-ScaffoldTemplate], COMException
    • FullyQualifiedErrorId : T4Scaffolding.Cmdlets.InvokeScaffoldTemplateCmdlet

Invoke-ScaffoldTemplate : Error HRESULT E_FAIL has been returned from a call to a COM component.
At C:\repos\operations\packages\MvcMailer.1.1\tools\MailerFunctions.ps1:54 char:39

  •     $wroteFile = Invoke-ScaffoldTemplate <<<<  -Template $templateFile -Model @{
    
    • CategoryInfo : NotSpecified: (:) [Invoke-ScaffoldTemplate], COMException
    • FullyQualifiedErrorId : T4Scaffolding.Cmdlets.InvokeScaffoldTemplateCmdlet

Invoke-ScaffoldTemplate : Error HRESULT E_FAIL has been returned from a call to a COM component.
At C:\repos\operations\packages\MvcMailer.1.1\tools\MailerFunctions.ps1:54 char:39

  •     $wroteFile = Invoke-ScaffoldTemplate <<<<  -Template $templateFile -Model @{
    
    • CategoryInfo : NotSpecified: (:) [Invoke-ScaffoldTemplate], COMException
    • FullyQualifiedErrorId : T4Scaffolding.Cmdlets.InvokeScaffoldTemplateCmdlet

Obviously, this is output from the second time I ran the command. Also, I made sure that the most recent versions of T4Scaffolding and MvcScaffolding were installed.

Missing SMTP host exception despite using SpecifiedPickupDirectory

When using SpecifiedPickupDirectory as the deliveryMethod in Web.config for testing (rather than Network with a host value), an InvalidOperationException is thrown with the message "The SMTP host was not specified."

at System.Net.Mail.SmtpClient.CheckHostAndPort()
at System.Net.Mail.SmtpClient.get_ServicePoint()
at System.Net.Mail.SmtpClient.Dispose(Boolean disposing)
at System.Net.Mail.SmtpClient.Dispose()
at Mvc.Mailer.SmtpClientWrapper.Send(MailMessage mailMessage)
at Mvc.Mailer.MailMessageExtensions.Send(MailMessage message, ISmtpClient smtpClient)
at MySite.Controllers.UsersController.ResetPassword(String userName)

Quartz + MVCMailer

How i use quartz.net and Mvc mailer together, because, the httpcontex é alwayz null..??

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.