This article will provide you with short example of sending e-mails using the code.
You can send an email programmatically through our API in the following way:
CMS.EmailEngine.EmailMessage em = new CMS.EmailEngine.EmailMessage();
em.EmailFormat = CMS.EmailEngine.EmailFormatEnum.Html;
em.From = "firstname.lastname@example.org";
em.Recipients = "email@example.com";
em.Subject = "Subject";
em.Body = "body of email";
Please make sure you have SMTP server specified in site settings for e-mails being sent properly.
There are two basic variations of SendEmail
//you can use CMS.CMSHelper.CMSContext.CurrentSiteName for site name
The first one sends e-mail using global settings, whilest the second one sends e-mail using settings for specified site. If you use the first option and it doesn't work for you, it can be caused by SMTP settings specified only for appropriate site - not globally.
How to send an email using the email template
Kentico CMS all versions
Created on 11/24/2008 6:52:55 AM
in Newsletters and E-mail