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
subjectContext
stringThe notification subject context. The resulting email subject will be "Acuit Pinpoint Notification: ", followed by this subject context.
body
stringThe notification body.
attachments
Attachment[]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
message
MailMessageThe 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
message
is 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
recipients
stringThe addresses that the message is sent to. Multiple addresses should be separated by commas.
subject
stringThe subject line for the message.
body
stringThe 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
recipients
is null.- ArgumentException
recipients
is empty.- FormatException
recipients
is 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
from
stringThe address information of the message sender.
recipients
stringThe addresses that the message is sent to. Multiple addresses should be separated by commas.
subject
stringThe subject line for the message.
body
stringThe message body.
Remarks
The email is immediately and synchronously sent.
Exceptions
- ArgumentNullException
from
is null.- ArgumentNullException
recipients
is null.- ArgumentException
from
is empty.- ArgumentException
recipients
is empty.- FormatException
from
is malformed.- FormatException
recipients
is 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
message
MailMessageThe 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
message
is 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
recipients
stringThe addresses that the message is sent to. Multiple addresses should be separated by commas.
subject
stringThe subject line for the message.
body
stringThe message body.
Returns
Remarks
The "From email address" configured for the server will be used.
The email is sent asynchronously.
Exceptions
- ArgumentNullException
recipients
is null.- ArgumentException
recipients
is empty.- FormatException
recipients
is 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
from
stringThe address information of the message sender.
recipients
stringThe addresses that the message is sent to. Multiple addresses should be separated by commas.
subject
stringThe subject line for the message.
body
stringThe message body.
Returns
Remarks
The email is sent asynchronously.
Exceptions
- ArgumentNullException
from
is null.- ArgumentNullException
recipients
is null.- ArgumentException
from
is empty.- ArgumentException
recipients
is empty.- FormatException
from
is malformed.- FormatException
recipients
is 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
recipients
stringThe email addresses to which to send the notification. Multiple addresses should be separated by commas.
subjectContext
stringThe notification subject context. The resulting email subject will be "Acuit Pinpoint Notification: ", followed by this subject context.
body
stringThe notification body.
attachments
Attachment[]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
recipients
is null.
TestServerEmail(ServerSettings)
Tests Acuit Pinpoint Server email settings.
void TestServerEmail(ServerSettings settings)
Parameters
settings
ServerSettingsThe email settings to test.
Remarks
If no exception is thrown, the test succeeded.
Exceptions
- ArgumentNullException
settings
is null.- ArgumentException
The
settings
properties are not valid.- ArgumentException
The test failed. See the exception message for details.