IEmailService Interface |
Namespace: NetQuarry.Services
The IEmailService type exposes the following members.
Name | Description | |
---|---|---|
IsSendAsync |
Returns true if the service delivers mail asynchronously.
| |
IsValidConfig |
Returns true if the Smtp configuration is valid.
| |
ServiceName |
Returns the name of the email service.
|
Name | Description | |
---|---|---|
ConstructMessage |
Constructs a MailMessage object using the specified destination parameters
including optional attachments and Template.
| |
Send(MailMessage) |
Sends an e-mail message using arguments supplied in the properties of the MailMessage class.
| |
Send(Message) |
Sends an email message using arguments supplied in the properties of the Message class.
| |
Send(MailMessage, SendEmailFlags) |
Sends an e-mail message using arguments supplied in the properties of the MailMessage class and with SendEmailFlags options.
| |
Send(MailMessage, SendEmailFlags, String) |
Sends an e-mail message using arguments supplied in the properties of the MailMessage class,
with SendEmailFlags options, and using a Template for the email composition.
| |
Send(String, String, String, String) |
Sends a text (not HTML) e-mail message using the specified basic parameters (from, to, subject, messageText).
| |
Send(String, String, String, String, Boolean) |
Sends a text or HTML e-mail message using the specified basic parameters (from, to, subject, messageText).
| |
Send(String, String, String, String, Boolean, String) |
Sends a text or HTML e-mail message using the specified basic parameters (from, to, subject, messageText)
and using a Template for the email composition.
| |
Send(String, String, String, String, String, String, Boolean) |
Sends a text or HTML e-mail message using the specified basic parameters (from, to, subject, messageText),
with CC and BCC addresses, and using a Template for the email composition.
| |
Send(String, String, String, String, String, String, Boolean, Attachment) |
Sends a text or HTML e-mail message using the specified basic parameters (from, to, subject, messageText),
with CC and BCC addresses, and with attachments.
| |
Send(String, String, String, String, String, String, Boolean, Attachment, SendEmailFlags) |
Sends a text or HTML e-mail message using the specified basic parameters (from, to, subject, messageText),
with CC and BCC addresses, with attachments, and with SendEmailFlags options.
| |
Send(String, String, String, String, String, String, Boolean, Attachment, SendEmailFlags, String) |
Sends a text or HTML e-mail message using the specified basic parameters (from, to, subject, messageText),
with CC and BCC addresses, with attachments, with SendEmailFlags options, and using a Template for the email composition.
|
private void Send(IAppContext appContext, string sendToList, string templateName, NameValueCollection nameValues) { ServiceInfos svs = appContext.Services; IEmailService mail = (IEmailService)svs.GetServiceInstance("SmtpMail"); NetQuarry.Template tmpl = appContext.Templates[templateName]; string body; string subject; if (tmpl == null) throw new ApplicationException(string.Format(this.TextItems.GetText(IDS_MISSING_TEMPLATE), templateName)); body = tmpl.Replace(nameValues); subject = tmpl.TextItems.GetText("Subject"); try { //--- leave the From field empty, it will default to the value configured in the studio mail.Send(string.Empty, sendToList, subject, body, true); } catch(Exception ex) { //--- log the error then re-throw DevLog.LogMessage("XIssue.Send", "sendMailError", ex); throw; } }