MailDefinition Creator CreateMailMessage from ASP.Net MVC Controller

What can I send to the owner for MailDefinition.CreateMailMessage () sent via the ASP.Net MVC controller?

//   owner:
//     The System.Web.UI.Control that owns this System.Web.UI.WebControls.MailDefinition.
public MailMessage CreateMailMessage(string recipients, IDictionary replacements, Control owner);

Edit: submitting a new System.Web.UI.Control () seems to work fine. Is there any other / standard solution?

+3
source share
1 answer

I had the same problem as Adam after adapting the code described in system.web.ui.webcontrols.maildefinition

The solution is to replace "this" with "new System.Web.UI.Control ()"

For example, in the above C # Microsoft example, instead of

fileMsg = md.CreateMailMessage(sourceTo.Text, replacements, this);

In the MVC controller you should write:

fileMsg = mailDefinition.CreateMailMessage("email@address.com", replacements, new System.Web.UI.Control());
+9
source

Source: https://habr.com/ru/post/1703967/


All Articles