Interface INotificationService
The notification service provided by Acuit Pinpoint Server.
public interface INotificationService
Methods
SendAdminNotification(string, string, params Attachment[])
Sends a notification to the administrators.
void SendAdminNotification(string subjectContext, string body, params Attachment[] attachments)
Parameters
subjectContextstringThe notification subject context. The resulting email subject will be "Acuit Pinpoint Notification: ", followed by this subject context.
bodystringThe notification body.
attachmentsAttachment[]Optional attachments.
Remarks
Currently, notifications are only sent via email, which requires the mail settings to be configured for the server.
Details about the notification are logged to the application log before attempting to send the email.
Notifications are sent asynchrously; this method will immediately return. If an error occurs (e.g., mail settings have not been configured, or an error occurred while trying to send the email), error details will be logged to the application log, but no exception will be thrown.
SendMail(MailMessage)
Sends an email.
void SendMail(MailMessage message)
Parameters
messageMailMessageThe message to send.
Remarks
If From is not specified, then the "From email address" configured for the server will be used.
The email is immediately and synchronously sent.
Exceptions
- ArgumentNullException
messageis null.- InvalidOperationException
The mail settings have not been configured.
- InvalidOperationException
There are no recipients specified in To, CC, and Bcc properties.
- SmtpException
The message could not be sent.
SendMail(string, string, string)
Sends an email.
void SendMail(string recipients, string subject, string body)
Parameters
recipientsstringThe addresses that the message is sent to. Multiple addresses should be separated by commas.
subjectstringThe subject line for the message.
bodystringThe message body.
Remarks
The "From email address" configured for the server will be used.
The email is immediately and synchronously sent.
Exceptions
- InvalidOperationException
The mail settings have not been configured.
- ArgumentNullException
recipientsis null.- ArgumentException
recipientsis empty.- FormatException
recipientsis malformed.- SmtpException
The message could not be sent.
SendMail(string, string, string, string)
Sends an email.
void SendMail(string from, string recipients, string subject, string body)
Parameters
fromstringThe address information of the message sender.
recipientsstringThe addresses that the message is sent to. Multiple addresses should be separated by commas.
subjectstringThe subject line for the message.
bodystringThe message body.
Remarks
The email is immediately and synchronously sent.
Exceptions
- ArgumentNullException
fromis null.- ArgumentNullException
recipientsis null.- ArgumentException
fromis empty.- ArgumentException
recipientsis empty.- FormatException
fromis malformed.- FormatException
recipientsis malformed.- InvalidOperationException
The mail settings have not been configured.
- SmtpException
The message could not be sent.
SendMailAsync(MailMessage)
Sends an email asynchronously.
Task SendMailAsync(MailMessage message)
Parameters
messageMailMessageThe message to send.
Returns
Remarks
The email is sent asynchronously.
If From is not specified, then the "From email address" configured for the server will be used.
Exceptions
- ArgumentNullException
messageis null.- InvalidOperationException
The mail settings have not been configured.
- InvalidOperationException
There are no recipients specified in To, CC, and Bcc properties.
- SmtpException
The message could not be sent.
SendMailAsync(string, string, string)
Sends an email asynchronously.
Task SendMailAsync(string recipients, string subject, string body)
Parameters
recipientsstringThe addresses that the message is sent to. Multiple addresses should be separated by commas.
subjectstringThe subject line for the message.
bodystringThe message body.
Returns
Remarks
The "From email address" configured for the server will be used.
The email is sent asynchronously.
Exceptions
- ArgumentNullException
recipientsis null.- ArgumentException
recipientsis empty.- FormatException
recipientsis malformed.- InvalidOperationException
The mail settings have not been configured.
- SmtpException
The message could not be sent.
SendMailAsync(string, string, string, string)
Sends an email asynchronously.
Task SendMailAsync(string from, string recipients, string subject, string body)
Parameters
fromstringThe address information of the message sender.
recipientsstringThe addresses that the message is sent to. Multiple addresses should be separated by commas.
subjectstringThe subject line for the message.
bodystringThe message body.
Returns
Remarks
The email is sent asynchronously.
Exceptions
- ArgumentNullException
fromis null.- ArgumentNullException
recipientsis null.- ArgumentException
fromis empty.- ArgumentException
recipientsis empty.- FormatException
fromis malformed.- FormatException
recipientsis malformed.- InvalidOperationException
The mail settings have not been configured.
- SmtpException
The message could not be sent.
SendNotification(string, string, string, params Attachment[])
Sends a notification.
void SendNotification(string recipients, string subjectContext, string body, params Attachment[] attachments)
Parameters
recipientsstringThe email addresses to which to send the notification. Multiple addresses should be separated by commas.
subjectContextstringThe notification subject context. The resulting email subject will be "Acuit Pinpoint Notification: ", followed by this subject context.
bodystringThe notification body.
attachmentsAttachment[]Optional attachments.
Remarks
Currently, notifications are only sent via email, which requires the mail settings to be configured for the server.
Details about the notification are logged to the application log before attempting to send the email.
Notifications are sent asynchrously; this method will immediately return. If an error occurs (e.g., mail settings have not been configured, or an error occurred while trying to send the email), error details will be logged to the application log, but no exception will be thrown.
Exceptions
- ArgumentNullException
recipientsis null.
TestServerEmail(ServerSettings)
Tests Acuit Pinpoint Server email settings.
void TestServerEmail(ServerSettings settings)
Parameters
settingsServerSettingsThe email settings to test.
Remarks
If no exception is thrown, the test succeeded.
Exceptions
- ArgumentNullException
settingsis null.- ArgumentException
The
settingsproperties are not valid.- ArgumentException
The test failed. See the exception message for details.