Documentation > CMS Template API Library > Util > Email(String,String,String,String,ContentType)
Used to send an email from the cms.
public System.Boolean Email(String,String,String,String,ContentType)
Returns
True if the email was successfully sent. Check context.Error if there is a failure.
Parameters
| Name | Description | Type |
|---|---|---|
| subject | The subject of the email. | System.String |
| message | The message body of the email. | System.String |
| recepient | The recepient. | System.String |
| from | The From field of the email. The default value is null. When null the from address will be cms@[instance name].com | System.String |
| contentType | Type of the content. Defaults to text/plain | CrownPeak.CMSAPI.ContentType |
Code Example
C#
Sample:
if (!Util.Email("CrownPeak CMS!", "<a href=\"http://www.crownpeak.com\">CrownPeak</a>", "bar@bar.com", "foo@bar.com, ContentType.TextHtml))
{
Out.WriteLine("Failed to send email : " + context.Error);
}