This content is part of a third party extension that is not supported by the Cake project.
For more information about this extension see
Cake.CakeMail.
Summary
Send an email through CakeMail.
Syntax
public CakeMailResult SendEmail(string senderName, string senderAddress, IEnumerable<string> recipientsAddress, string subject, string htmlContent, string textContent, CakeMailSettings settings)
Examples
var apiKey = "... your api key ...";
var userName = "... your username ...";
var password = "... your password ...";
try
{
var result = CakeMail.SendEmail(
senderName: "Bob Smith",
senderAddress: "[email protected]",
recipients: new[] { "[email protected]", "[email protected]" },
subject: "This is a test",
htmlContent: "This is a test",
textContent: "This is a test",
settings: new CakeMailEmailSettings
{
ApiKey = apiKey,
UserName = userName,
Password = password
}
);
if (result.Ok)
{
Information("Email successfully sent");
}
else
{
Error("Failed to send email: {0}", result.Error);
}
}
catch(Exception ex)
{
Error("{0}", ex);
}
Attributes
Type |
Description |
CakeAliasCategoryAttribute |
|
Parameters
Name |
Type |
Description |
senderName |
string |
The name of the person sending the email. |
senderAddress |
string |
The email addresses of the person sending the email. |
recipientsAddress |
IEnumerable<string> |
The email addresses of the recipients who will recieve the email. |
subject |
string |
The subject line of the email. |
htmlContent |
string |
The HTML content. |
textContent |
string |
The text content. |
settings |
CakeMailSettings |
The settings to be used when sending the email. |
Return Value