SmtpMessageService

Implements an IMessageService that send messages through e-mail.

Namespace:
Inetdev.Messaging
Type:
Class
Public:
Yes
Protected:
No
Sealed:
Yes
Abstract:
No
Inherits from:
System.Object
Implements:
Inetdev.PropertyBag.IPropertyBag, Inetdev.Messaging.IMessageService

Remarks

This class implements a property bag for easyly store configuration.

Constructors

SmtpMessageService

Default constructor

Signature:
public Void SmtpMessageService()

Properties

From

From address.

Signature:
public String From { get; set; }

FromName

From address display name.

Signature:
public String FromName { get; set; }

Password

Password to connect to the SMTP server.

Signature:
public String Password { get; set; }

Port

SMTP server port.

Signature:
public Int32 Port { get; set; }

RequiresSsl

Whether the SMTP server requires a SSL connection.

Signature:
public Boolean RequiresSsl { get; set; }

Server

SMTP server name of IP.

Signature:
public String Server { get; set; }

UserName

User name to connect to the SMTP server.

Signature:
public String UserName { get; set; }

Methods

IsEnabled

Checks whether this services is considered enabled.

Signature:
public Boolean IsEnabled()
Returns

true if this service is consedered enabled, otherwise false.

Remarks

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.

SendAsync

Sends the message through e-mail.

Signature:
public Task SendAsync(message)
Remarks

This method attempts to send the message only if it is consedered enabled otherwise it does nothing.

Se documentation on the IsEnabled method.

Parameters
Name Type Summary
message Message A Message to be send by e-mail.
Exceptions
Type Summary
ArgumentNullException Thrown when message is null.
SendException Thrown when an error occurs while sending the message.