Developer forum

Forum » Development » Trigger email flow through view

Trigger email flow through view

Daniel Hollmann
Reply

Hi DynamicWeb,

We are having some trouble figuring out how to send an email through the EmailHandler class (https://doc.dynamicweb.com/api/html/79812e7d-6b41-b303-85fc-451aab25723c.htm) and would therefore like to hear about i have a code snippet example of how to use the Class to send an email. Is it something you can point to or say if it can be done? Does it require any specific plugins/nuget packages etc?

A bonus question is whether there is a way to retrieve a mail template from DW campaigns, for example, into the code and use it for the mails sent?


Replies

 
Morten Snedker Dynamicweb Employee
Morten Snedker
Reply
This post has been marked as an answer

Hi Daniel,

You need a reference to the Dynamicweb.Mailing namespace. Having that it is quite straight forward:

            System.Net.Mail.MailMessage message = new MailMessage();
            Dynamicweb.Mailing.EmailHandler.Send(message);

 

To retrieve mail template from campaign you should look into Dynamicweb.EmailMarketing.Renderer.

BR
Snedker

 

Votes for this answer: 1

 

You must be logged in to post in the forum