Implements an IMessageService that send messages through e-mail.
This class implements a property bag for easyly store configuration.
Default constructor
public Void SmtpMessageService()
From address.
public String From { get; set; }
From address display name.
public String FromName { get; set; }
Password to connect to the SMTP server.
public String Password { get; set; }
SMTP server port.
public Int32 Port { get; set; }
Whether the SMTP server requires a SSL connection.
public Boolean RequiresSsl { get; set; }
SMTP server name of IP.
public String Server { get; set; }
User name to connect to the SMTP server.
public String UserName { get; set; }
Checks whether this services is considered enabled.
public Boolean IsEnabled()
true if this service is consedered enabled, otherwise false.
This service is considered enabled when the properties From
and Server
has been configured and the From
property is a valid email address, otherwise this service
is disabled.
Sends the message through e-mail.
public Task SendAsync(message)
This method attempts to send the message only if it is consedered enabled otherwise it does nothing.
Se documentation on the IsEnabled
method.
Name | Type | Summary |
---|---|---|
message | Message | A Message to be send by e-mail. |
Type | Summary |
---|---|
ArgumentNullException | Thrown when message is null. |
SendException | Thrown when an error occurs while sending the message. |
In this document