Table of Contents

Class MailSenderService

Namespace
SunamoMail.Services
Assembly
SunamoMail.dll

Email sending service supporting multiple providers.

public class MailSenderService
Inheritance
MailSenderService
Inherited Members
Extension Methods

Constructors

MailSenderService(ILogger)

Email sending service supporting multiple providers.

public MailSenderService(ILogger logger)

Parameters

logger ILogger

Methods

SendCentrum(int, From, string, MailMessage)

Sends email via Centrum.cz SMTP server. Note: Centrum now requires SMS verification code for each email sent via SMTP, making this method impractical for automated sending. After one email succeeds, subsequent emails will be blocked.

public bool SendCentrum(int attempts, From from, string to, MailMessage mailMessage)

Parameters

attempts int

Number of send attempts to make before giving up.

from From

Sender credentials (name, email, password).

to string

Recipient email address.

mailMessage MailMessage

Pre-configured mail message to send.

Returns

bool

True if email was sent successfully, false otherwise.

SendSeznam(int, From, string, MailMessage)

Sends email via Seznam.cz SMTP server. Note: This method may timeout at smtpClient.Send with "The operation has timed out." Consider using Seznam Email Pro for better reliability. Alternatively, try using a desktop email client to verify SMTP settings.

public bool SendSeznam(int attempts, From from, string to, MailMessage mailMessage)

Parameters

attempts int

Number of send attempts to make before giving up.

from From

Sender credentials (name, email, password).

to string

Recipient email address.

mailMessage MailMessage

Pre-configured mail message to send.

Returns

bool

True if email was sent successfully, false otherwise.

SendSeznamMailkitWorker(int, From, string, string, string, IEnumerable<string>)

Sends email via Seznam.cz using MailKit library with retry logic. This is an async worker method that attempts to send the email multiple times.

public Task<bool> SendSeznamMailkitWorker(int attempts, From from, string to, string subject, string plainTextBody, IEnumerable<string> attachments)

Parameters

attempts int

Number of send attempts to make before giving up.

from From

Sender credentials (name, email, password).

to string

Recipient email address.

subject string

Email subject line.

plainTextBody string

Plain text email body content.

attachments IEnumerable<string>

Collection of file paths to attach to the email.

Returns

Task<bool>

True if email was sent successfully, false otherwise.

SendSeznamMailkitWorker(int, From, string, string, string, IEnumerable<string>, IEnumerable<string>?)

Sends email via Seznam.cz using MailKit library with retry logic and optional CC recipients.

public Task<bool> SendSeznamMailkitWorker(int attempts, From from, string to, string subject, string plainTextBody, IEnumerable<string> attachments, IEnumerable<string>? cc)

Parameters

attempts int

Number of send attempts to make before giving up.

from From

Sender credentials (name, email, password).

to string

Recipient email address.

subject string

Email subject line.

plainTextBody string

Plain text email body content.

attachments IEnumerable<string>

Collection of file paths to attach to the email.

cc IEnumerable<string>

Optional collection of CC email addresses.

Returns

Task<bool>

True if email was sent successfully, false otherwise.