GPAL - Generally Positive Automation Library v1.0
GPAL The Fluent Automation LIbrary
Loading...
Searching...
No Matches
GenerallyPositive.GPALMail Class Reference

Provides a fluent API for configuring, sending, and receiving email via SMTP, IMAP, and POP. Supports specifying server connection settings, envelope details (from/to/cc/bcc, subject, body, attachments), sending mail through SMTP, retrieving messages from an IMAP inbox, and persisting/loading mail settings to/from a GPALFile. More...

Inheritance diagram for GenerallyPositive.GPALMail:
GenerallyPositive.IGPALMail GenerallyPositive.IAllowEmailEnvelopeAndActions GenerallyPositive.IAllowEmailServerSettingsAndName GenerallyPositive.IAllowNameEnvelopeAndActions GenerallyPositive.IAllowEmailEnvelope GenerallyPositive.IAllowToGPALObject< TResult > GenerallyPositive.IAllowToGPALObject< TResult > GenerallyPositive.IAllowEmailActions GenerallyPositive.IAllowEmailReceiveOptions GenerallyPositive.IAllowEmailEnvelope GenerallyPositive.IAllowName GenerallyPositive.IAllowEmailReceiveOptions GenerallyPositive.IAllowEmailEnvelope GenerallyPositive.IAllowEmailServerSettings GenerallyPositive.IAllowToGPALObject< TResult > GenerallyPositive.IAllowToGPALObject< TResult > GenerallyPositive.IAllowEmailActions GenerallyPositive.IAllowEmailReceiveOptions GenerallyPositive.IAllowEmailEnvelope

Classes

class  MailError
 What went wrong on the last call, and enough about it to act on.
Sent says whether the mail went. This says why it did not, which is what a workflow needs when the answer decides what to do next. More...

Public Member Functions

IGPALMail ToGPALObject ()
 Returns this instance cast to IGPALMail, allowing the fluent chain to be converted back to the root mail interface.
IAllowEmailServerSettingsAndName WithIMAPServerName (string serverName)
 Sets the IMAP server hostname used for receiving mail, and forgets any POP server, since Receive reads from one server or the other.
IAllowEmailServerSettingsAndName WithPOPServerName (string serverName)
 Sets the POP server hostname used for receiving mail, and forgets any IMAP server, since Receive reads from one server or the other.
IAllowEmailServerSettingsAndName WithSMTPServerName (string serverName)
 Sets the SMTP server hostname used for sending mail.
IAllowEmailServerSettingsAndName WithIMAPPortNum (int portNum=993)
 Sets the port number used to connect to the IMAP server.
IAllowEmailServerSettingsAndName WithPOPPortNum (int portNum=110)
 Sets the port number used to connect to the POP server.
IAllowEmailServerSettingsAndName WithSMTPPortNum (int portNum=465)
 Sets the port number used to connect to the SMTP server.
IAllowEmailServerSettingsAndName WithAcceptAnyCertificate (bool acceptAnyCertificate=true)
 Send even when the server's certificate cannot be validated.
Off unless a workflow says otherwise, and worth saying out loud: with this on, nothing checks who is on the other end of the connection, so a server standing in for yours is accepted along with a merely self-signed one. It is for an internal relay with a certificate nobody signed, not for the internet.
IAllowEmailServerSettingsAndName WithCredentials (ICredentials credentials)
 The credential to authenticate with, from wherever GPAL got it: a vault, a file, or set by hand. Its username and password win over WithUserName and WithPassword.
IAllowEmailServerSettingsAndName WithUserName (string userName)
 Sets the username used to authenticate with the mail server(s).
IAllowEmailServerSettingsAndName WithPassword (string password)
 Sets the password used to authenticate with the mail server(s).
IAllowNameEnvelopeAndActions WithFromEmailAddress (string mailAddress)
IAllowNameEnvelopeAndActions WithToEmailAddress (string mailAddress)
 Adds one or more "To" recipients, parsed from a single string that may contain multiple addresses delimited by commas, semicolons, or pipes.
IAllowNameEnvelopeAndActions WithCcEmailAddress (string mailAddress)
 Adds one or more "Cc" recipients, parsed from a single string that may contain multiple addresses delimited by commas, semicolons, or pipes.
IAllowNameEnvelopeAndActions WithBccEmailAddress (string mailAddress)
 Adds one or more "Bcc" recipients, parsed from a single string that may contain multiple addresses delimited by commas, semicolons, or pipes.
IAllowNameEnvelopeAndActions WithToEmailAddress (string[] emailParts)
 Adds one or more "To" recipients from an array of email address strings.
IAllowNameEnvelopeAndActions WithCcEmailAddress (string[] emailParts)
 Adds one or more "Cc" recipients from an array of email address strings.
IAllowNameEnvelopeAndActions WithBccEmailAddress (string[] emailParts)
 Adds one or more "Bcc" recipients from an array of email address strings.
IAllowEmailEnvelopeAndActions WithAttachment (GPALFile attachmentFile)
 Adds the file(s) referenced by the given GPALFile as email attachments. Each filename in GPALFile.Filenames is treated as a (possibly wildcarded) path; matching files in the resolved directory are added to the attachment list. Errors resolving or adding individual files are logged via GPAL.PublishSimpleEvent rather than thrown, allowing the remaining attachments to still be processed.
IAllowEmailEnvelopeAndActions WithBody (string body)
 Sets the message body, automatically detecting whether it is HTML or plain text via IsHtml(string) and storing it as GPALMailSettings.BodyHTML or GPALMailSettings.BodyText accordingly.
IAllowEmailEnvelopeAndActions WithSubject (string subject)
 Sets the subject line of the message.
IAllowEmailEnvelopeAndActions WithName (string name)
 Sets the display name on the address added just before this call, whether that was the from, a to, a cc or a bcc. Warns and does nothing when no address has been added yet.
IAllowEmailEnvelopeAndActions Send ()
 Builds the message from the configured envelope (from/to/cc/bcc, subject, body, attachments) and sends it via SMTP using GPALMailSettings.SMTPServerName and GPALMailSettings.SMTPPortNum. If the initial connection fails (typically due to a certificate issue), retries with certificate validation disabled and TLS 1.1/1.2 explicitly enabled.
IAllowEmailEnvelopeAndActions Receive ()
 Connects to the configured IMAP server, authenticates with GPALMailSettings.UserName and GPALMailSettings.Password, opens the inbox read-only, and copies every message into GPALMailSettings.ReceivedEmails as a ReceivedEmail (subject, from, and text body).
IAllowEmailEnvelopeAndActions Receive (out List< ReceivedEmail > receivedEmails)
 Reads the mail as Receive does and hands the messages over in one call.
IAllowEmailEnvelopeAndActions WithUnreadOnly (bool unreadOnly)
 Limits Receive() to the messages the server still has as unread. Off by default, so a Receive with nothing said fetches every message as it always has.
IAllowEmailEnvelopeAndActions WithMaxMessages (int maxMessages)
 Caps how many messages one Receive() fetches, taking the newest first. Every message by default, which on a mailbox of any size is a great deal of downloading.
IAllowEmailEnvelopeAndActions MarkAllAsRead ()
 Marks every message Receive() collected as read on the server, in one connection, so the next Receive set to unread only leaves them behind. Call it once the workflow has finished with them rather than before. IMAP only.
IAllowEmailEnvelopeAndActions DeleteAll ()
 Deletes every message Receive() collected from the server, flagging and expunging them in one connection. Anything not received is untouched, so this empties what the workflow read rather than the mailbox. IMAP only.
IAllowEmailEnvelopeAndActions SaveTo (GPALFile directory)
 Writes every attachment on every message Receive collected into the given directory, creating it when it is not there. Use ReceivedEmail.SaveTo(GPALFile) for one message's.
IAllowEmailEnvelopeAndActions Clear ()
 Resets the email envelope to a blank state: clears all recipient lists, subject, body text, attachments, and any received emails. The from address and the server connection settings (host/port/credentials) are left unchanged.
IAllowEmailEnvelopeAndActions LoadSettings (GPALFile mailSettingsFile=null)
 Loads this instance's GPALMailSettings from the given GPALFile via GPAL.Converter, replacing the current server connection and envelope settings.
IAllowEmailEnvelopeAndActions SaveSettings (GPALFile mailSettingsFile=null)
 Saves this instance's GPALMailSettings (server connection and envelope settings) to the given GPALFile via GPAL.Converter.

Static Public Member Functions

static List< MailboxAddress > ParseEmailAddresses (string input)
 Splits a single string containing one or more email addresses delimited by commas, semicolons, or pipes, and parses each into a MailboxAddress.

Properties

DateTime? Sent [get]
 When the last Send went out, null when it did not.
MailError LastError [get]
 The last failure, or null when the last call did not fail. Cleared at the start of Send and Receive(), so it always describes the most recent one.
string SMTPServerName [get]
 The SMTP server mail is sent through, as set by WithSMTPServerName or read from a settings file.
int SMTPPortNum [get]
 The port used to reach SMTPServerName.
string IMAPServerName [get]
 The IMAP server mail is read from, null when a POP server is the one named.
int IMAPPortNum [get]
 The port used to reach IMAPServerName.
string POPServerName [get]
 The POP server mail is read from, null when an IMAP server is the one named.
int POPPortNum [get]
 The port used to reach POPServerName.
string FromAddress [get]
 The address messages are sent from, as text, with the display name when there is one.

Detailed Description

Provides a fluent API for configuring, sending, and receiving email via SMTP, IMAP, and POP. Supports specifying server connection settings, envelope details (from/to/cc/bcc, subject, body, attachments), sending mail through SMTP, retrieving messages from an IMAP inbox, and persisting/loading mail settings to/from a GPALFile.

.WithSMTPServerName("smtp.example.com")
.WithSMTPPortNum(465)
.WithUserName("user@example.com")
.WithPassword("password")
.WithFromEmailAddress("user@example.com")
.WithToEmailAddress("recipient@example.com")
.WithSubject("Hello")
.WithBody("This is the message body.")
.Send();
static IAllowEmailServerSettings Mail
New GPAL Mail handler.
Definition GPAL.cs:558

Definition at line 54 of file GPALMail.cs.

Member Function Documentation

◆ Clear()

IAllowEmailEnvelopeAndActions GenerallyPositive.GPALMail.Clear ( )

Resets the email envelope to a blank state: clears all recipient lists, subject, body text, attachments, and any received emails. The from address and the server connection settings (host/port/credentials) are left unchanged.

Returns
Fluent interface to continue configuring the email envelope and actions.

Implements GenerallyPositive.IAllowEmailActions.

Definition at line 875 of file GPALMail.cs.

◆ DeleteAll()

IAllowEmailEnvelopeAndActions GenerallyPositive.GPALMail.DeleteAll ( )

Deletes every message Receive() collected from the server, flagging and expunging them in one connection. Anything not received is untouched, so this empties what the workflow read rather than the mailbox. IMAP only.

Returns
Fluent interface to continue configuring the email envelope and actions.

Implements GenerallyPositive.IAllowEmailActions.

Definition at line 787 of file GPALMail.cs.

◆ LoadSettings()

IAllowEmailEnvelopeAndActions GenerallyPositive.GPALMail.LoadSettings ( GPALFile mailSettingsFile = null)

Loads this instance's GPALMailSettings from the given GPALFile via GPAL.Converter, replacing the current server connection and envelope settings.

Parameters
mailSettingsFileThe file to load mail settings from.
Returns
Fluent interface to continue configuring the email envelope and actions.

Implements GenerallyPositive.IAllowEmailActions.

Definition at line 895 of file GPALMail.cs.

◆ MarkAllAsRead()

IAllowEmailEnvelopeAndActions GenerallyPositive.GPALMail.MarkAllAsRead ( )

Marks every message Receive() collected as read on the server, in one connection, so the next Receive set to unread only leaves them behind. Call it once the workflow has finished with them rather than before. IMAP only.

Returns
Fluent interface to continue configuring the email envelope and actions.

Implements GenerallyPositive.IAllowEmailActions.

Definition at line 775 of file GPALMail.cs.

◆ ParseEmailAddresses()

List< MailboxAddress > GenerallyPositive.GPALMail.ParseEmailAddresses ( string input)
static

Splits a single string containing one or more email addresses delimited by commas, semicolons, or pipes, and parses each into a MailboxAddress.

Parameters
inputA delimited string of one or more email addresses.
Returns
The parsed list of MailboxAddress values.

Definition at line 928 of file GPALMail.cs.

◆ Receive() [1/2]

IAllowEmailEnvelopeAndActions GenerallyPositive.GPALMail.Receive ( )

Connects to the configured IMAP server, authenticates with GPALMailSettings.UserName and GPALMailSettings.Password, opens the inbox read-only, and copies every message into GPALMailSettings.ReceivedEmails as a ReceivedEmail (subject, from, and text body).

Returns
Fluent interface to continue configuring the email envelope and actions.

Implements GenerallyPositive.IAllowEmailActions.

Definition at line 647 of file GPALMail.cs.

◆ Receive() [2/2]

IAllowEmailEnvelopeAndActions GenerallyPositive.GPALMail.Receive ( out List< ReceivedEmail > receivedEmails)

Reads the mail as Receive does and hands the messages over in one call.

Parameters
receivedEmailsReceives the messages, empty when nothing was fetched
Returns
Fluent interface to continue configuring the email envelope and actions.

Implements GenerallyPositive.IAllowEmailActions.

Definition at line 668 of file GPALMail.cs.

◆ SaveSettings()

IAllowEmailEnvelopeAndActions GenerallyPositive.GPALMail.SaveSettings ( GPALFile mailSettingsFile = null)

Saves this instance's GPALMailSettings (server connection and envelope settings) to the given GPALFile via GPAL.Converter.

Parameters
mailSettingsFileThe file to save mail settings to.
Returns
Fluent interface to continue configuring the email envelope and actions.

Implements GenerallyPositive.IAllowEmailActions.

Definition at line 915 of file GPALMail.cs.

◆ SaveTo()

IAllowEmailEnvelopeAndActions GenerallyPositive.GPALMail.SaveTo ( GPALFile directory)

Writes every attachment on every message Receive collected into the given directory, creating it when it is not there. Use ReceivedEmail.SaveTo(GPALFile) for one message's.

Parameters
directoryThe directory to write the attachments into
Returns
Fluent interface to continue building the email envelope and actions.

Implements GenerallyPositive.IAllowEmailActions.

Definition at line 857 of file GPALMail.cs.

◆ Send()

IAllowEmailEnvelopeAndActions GenerallyPositive.GPALMail.Send ( )

Builds the message from the configured envelope (from/to/cc/bcc, subject, body, attachments) and sends it via SMTP using GPALMailSettings.SMTPServerName and GPALMailSettings.SMTPPortNum. If the initial connection fails (typically due to a certificate issue), retries with certificate validation disabled and TLS 1.1/1.2 explicitly enabled.

Returns
Fluent interface to continue configuring the email envelope and actions.
.WithSMTPServerName("smtp.example.com")
.WithSMTPPortNum(465)
.WithFromEmailAddress("user@example.com")
.WithToEmailAddress("recipient@example.com")
.WithSubject("Hello")
.WithBody("This is the message body.")
.Send();

Implements GenerallyPositive.IAllowEmailActions.

Definition at line 556 of file GPALMail.cs.

◆ ToGPALObject()

IGPALMail GenerallyPositive.GPALMail.ToGPALObject ( )

Returns this instance cast to IGPALMail, allowing the fluent chain to be converted back to the root mail interface.

Returns
This instance as IGPALMail.

Implements GenerallyPositive.IAllowToGPALObject< TResult >.

Definition at line 92 of file GPALMail.cs.

◆ WithAcceptAnyCertificate()

IAllowEmailServerSettingsAndName GenerallyPositive.GPALMail.WithAcceptAnyCertificate ( bool acceptAnyCertificate = true)

Send even when the server's certificate cannot be validated.
Off unless a workflow says otherwise, and worth saying out loud: with this on, nothing checks who is on the other end of the connection, so a server standing in for yours is accepted along with a merely self-signed one. It is for an internal relay with a certificate nobody signed, not for the internet.

Parameters
acceptAnyCertificateTrue to send without checking the certificate
Returns
Fluent interface to continue configuring email server settings.

Implements GenerallyPositive.IAllowEmailServerSettings.

Definition at line 171 of file GPALMail.cs.

◆ WithAttachment()

IAllowEmailEnvelopeAndActions GenerallyPositive.GPALMail.WithAttachment ( GPALFile attachmentFile)

Adds the file(s) referenced by the given GPALFile as email attachments. Each filename in GPALFile.Filenames is treated as a (possibly wildcarded) path; matching files in the resolved directory are added to the attachment list. Errors resolving or adding individual files are logged via GPAL.PublishSimpleEvent rather than thrown, allowing the remaining attachments to still be processed.

Parameters
attachmentFileThe GPALFile describing the file(s) to attach.
Returns
Fluent interface to continue configuring the email envelope and actions.

Implements GenerallyPositive.IAllowEmailEnvelope.

Definition at line 464 of file GPALMail.cs.

◆ WithBccEmailAddress() [1/2]

IAllowNameEnvelopeAndActions GenerallyPositive.GPALMail.WithBccEmailAddress ( string mailAddress)

Adds one or more "Bcc" recipients, parsed from a single string that may contain multiple addresses delimited by commas, semicolons, or pipes.

Parameters
mailAddressA delimited string of one or more recipient email addresses.
Returns
Fluent interface to continue configuring the email envelope and actions.

Implements GenerallyPositive.IAllowEmailEnvelope.

Definition at line 402 of file GPALMail.cs.

◆ WithBccEmailAddress() [2/2]

IAllowNameEnvelopeAndActions GenerallyPositive.GPALMail.WithBccEmailAddress ( string[] emailParts)

Adds one or more "Bcc" recipients from an array of email address strings.

Parameters
emailPartsAn array of recipient email addresses.
Returns
Fluent interface to continue configuring the email envelope and actions.

Implements GenerallyPositive.IAllowEmailEnvelope.

Definition at line 446 of file GPALMail.cs.

◆ WithBody()

IAllowEmailEnvelopeAndActions GenerallyPositive.GPALMail.WithBody ( string body)

Sets the message body, automatically detecting whether it is HTML or plain text via IsHtml(string) and storing it as GPALMailSettings.BodyHTML or GPALMailSettings.BodyText accordingly.

Parameters
bodyThe message body, as plain text or HTML markup.
Returns
Fluent interface to continue configuring the email envelope and actions.

Implements GenerallyPositive.IAllowEmailEnvelope.

Definition at line 500 of file GPALMail.cs.

◆ WithCcEmailAddress() [1/2]

IAllowNameEnvelopeAndActions GenerallyPositive.GPALMail.WithCcEmailAddress ( string mailAddress)

Adds one or more "Cc" recipients, parsed from a single string that may contain multiple addresses delimited by commas, semicolons, or pipes.

Parameters
mailAddressA delimited string of one or more recipient email addresses.
Returns
Fluent interface to continue configuring the email envelope and actions.

Implements GenerallyPositive.IAllowEmailEnvelope.

Definition at line 386 of file GPALMail.cs.

◆ WithCcEmailAddress() [2/2]

IAllowNameEnvelopeAndActions GenerallyPositive.GPALMail.WithCcEmailAddress ( string[] emailParts)

Adds one or more "Cc" recipients from an array of email address strings.

Parameters
emailPartsAn array of recipient email addresses.
Returns
Fluent interface to continue configuring the email envelope and actions.

Implements GenerallyPositive.IAllowEmailEnvelope.

Definition at line 431 of file GPALMail.cs.

◆ WithCredentials()

IAllowEmailServerSettingsAndName GenerallyPositive.GPALMail.WithCredentials ( ICredentials credentials)

The credential to authenticate with, from wherever GPAL got it: a vault, a file, or set by hand. Its username and password win over WithUserName and WithPassword.

Parameters
credentialsThe credential to authenticate with
Returns
Fluent interface to define more email settings.

Implements GenerallyPositive.IAllowEmailServerSettings.

Definition at line 182 of file GPALMail.cs.

◆ WithFromEmailAddress()

IAllowNameEnvelopeAndActions GenerallyPositive.GPALMail.WithFromEmailAddress ( string mailAddress)

Implements GenerallyPositive.IAllowEmailEnvelope.

Definition at line 358 of file GPALMail.cs.

◆ WithIMAPPortNum()

IAllowEmailServerSettingsAndName GenerallyPositive.GPALMail.WithIMAPPortNum ( int portNum = 993)

Sets the port number used to connect to the IMAP server.

Parameters
portNumThe IMAP port number. Defaults to 993 (IMAP over SSL/TLS).
Returns
Fluent interface to continue configuring email server settings.

Implements GenerallyPositive.IAllowEmailServerSettings.

Definition at line 138 of file GPALMail.cs.

◆ WithIMAPServerName()

IAllowEmailServerSettingsAndName GenerallyPositive.GPALMail.WithIMAPServerName ( string serverName)

Sets the IMAP server hostname used for receiving mail, and forgets any POP server, since Receive reads from one server or the other.

Parameters
serverNameThe IMAP server hostname or address.
Returns
Fluent interface to continue configuring email server settings.

Implements GenerallyPositive.IAllowEmailServerSettings.

Definition at line 102 of file GPALMail.cs.

◆ WithMaxMessages()

IAllowEmailEnvelopeAndActions GenerallyPositive.GPALMail.WithMaxMessages ( int maxMessages)

Caps how many messages one Receive() fetches, taking the newest first. Every message by default, which on a mailbox of any size is a great deal of downloading.

Parameters
maxMessagesThe most messages to fetch.
Returns
Fluent interface to continue configuring the email envelope and actions.

Implements GenerallyPositive.IAllowEmailReceiveOptions.

Definition at line 697 of file GPALMail.cs.

◆ WithName()

IAllowEmailEnvelopeAndActions GenerallyPositive.GPALMail.WithName ( string name)

Sets the display name on the address added just before this call, whether that was the from, a to, a cc or a bcc. Warns and does nothing when no address has been added yet.

Parameters
nameThe display name to show alongside that address.
Returns
Fluent interface to continue configuring the email envelope and actions.

Implements GenerallyPositive.IAllowName.

Definition at line 526 of file GPALMail.cs.

◆ WithPassword()

IAllowEmailServerSettingsAndName GenerallyPositive.GPALMail.WithPassword ( string password)

Sets the password used to authenticate with the mail server(s).

Parameters
passwordThe account password.
Returns
Fluent interface to continue configuring email server settings.

Implements GenerallyPositive.IAllowEmailServerSettings.

Definition at line 344 of file GPALMail.cs.

◆ WithPOPPortNum()

IAllowEmailServerSettingsAndName GenerallyPositive.GPALMail.WithPOPPortNum ( int portNum = 110)

Sets the port number used to connect to the POP server.

Parameters
portNumThe POP port number. Defaults to 110 (plain POP3).
Returns
Fluent interface to continue configuring email server settings.

Implements GenerallyPositive.IAllowEmailServerSettings.

Definition at line 148 of file GPALMail.cs.

◆ WithPOPServerName()

IAllowEmailServerSettingsAndName GenerallyPositive.GPALMail.WithPOPServerName ( string serverName)

Sets the POP server hostname used for receiving mail, and forgets any IMAP server, since Receive reads from one server or the other.

Parameters
serverNameThe POP server hostname or address.
Returns
Fluent interface to continue configuring email server settings.

Implements GenerallyPositive.IAllowEmailServerSettings.

Definition at line 115 of file GPALMail.cs.

◆ WithSMTPPortNum()

IAllowEmailServerSettingsAndName GenerallyPositive.GPALMail.WithSMTPPortNum ( int portNum = 465)

Sets the port number used to connect to the SMTP server.

Parameters
portNumThe SMTP port number. Defaults to 465 (SMTP over SSL/TLS).
Returns
Fluent interface to continue configuring email server settings.

Implements GenerallyPositive.IAllowEmailServerSettings.

Definition at line 158 of file GPALMail.cs.

◆ WithSMTPServerName()

IAllowEmailServerSettingsAndName GenerallyPositive.GPALMail.WithSMTPServerName ( string serverName)

Sets the SMTP server hostname used for sending mail.

Parameters
serverNameThe SMTP server hostname or address.
Returns
Fluent interface to continue configuring email server settings.

Implements GenerallyPositive.IAllowEmailServerSettings.

Definition at line 127 of file GPALMail.cs.

◆ WithSubject()

IAllowEmailEnvelopeAndActions GenerallyPositive.GPALMail.WithSubject ( string subject)

Sets the subject line of the message.

Parameters
subjectThe subject text.
Returns
Fluent interface to continue configuring the email envelope and actions.

Implements GenerallyPositive.IAllowEmailEnvelope.

Definition at line 514 of file GPALMail.cs.

◆ WithToEmailAddress() [1/2]

IAllowNameEnvelopeAndActions GenerallyPositive.GPALMail.WithToEmailAddress ( string mailAddress)

Adds one or more "To" recipients, parsed from a single string that may contain multiple addresses delimited by commas, semicolons, or pipes.

Parameters
mailAddressA delimited string of one or more recipient email addresses.
Returns
Fluent interface to continue configuring the email envelope and actions.

Implements GenerallyPositive.IAllowEmailEnvelope.

Definition at line 370 of file GPALMail.cs.

◆ WithToEmailAddress() [2/2]

IAllowNameEnvelopeAndActions GenerallyPositive.GPALMail.WithToEmailAddress ( string[] emailParts)

Adds one or more "To" recipients from an array of email address strings.

Parameters
emailPartsAn array of recipient email addresses.
Returns
Fluent interface to continue configuring the email envelope and actions.

Implements GenerallyPositive.IAllowEmailEnvelope.

Definition at line 416 of file GPALMail.cs.

◆ WithUnreadOnly()

IAllowEmailEnvelopeAndActions GenerallyPositive.GPALMail.WithUnreadOnly ( bool unreadOnly)

Limits Receive() to the messages the server still has as unread. Off by default, so a Receive with nothing said fetches every message as it always has.

Parameters
unreadOnlyTrue to fetch only unread messages.
Returns
Fluent interface to continue configuring the email envelope and actions.

Implements GenerallyPositive.IAllowEmailReceiveOptions.

Definition at line 685 of file GPALMail.cs.

◆ WithUserName()

IAllowEmailServerSettingsAndName GenerallyPositive.GPALMail.WithUserName ( string userName)

Sets the username used to authenticate with the mail server(s).

Parameters
userNameThe account username.
Returns
Fluent interface to continue configuring email server settings.

Implements GenerallyPositive.IAllowEmailServerSettings.

Definition at line 334 of file GPALMail.cs.

Property Documentation

◆ FromAddress

string GenerallyPositive.GPALMail.FromAddress
get

The address messages are sent from, as text, with the display name when there is one.

Implements GenerallyPositive.IGPALMail.

Definition at line 310 of file GPALMail.cs.

◆ IMAPPortNum

int GenerallyPositive.GPALMail.IMAPPortNum
get

The port used to reach IMAPServerName.

Implements GenerallyPositive.IGPALMail.

Definition at line 304 of file GPALMail.cs.

◆ IMAPServerName

string GenerallyPositive.GPALMail.IMAPServerName
get

The IMAP server mail is read from, null when a POP server is the one named.

Implements GenerallyPositive.IGPALMail.

Definition at line 302 of file GPALMail.cs.

◆ LastError

MailError GenerallyPositive.GPALMail.LastError
get

The last failure, or null when the last call did not fail. Cleared at the start of Send and Receive(), so it always describes the most recent one.

Implements GenerallyPositive.IGPALMail.

Definition at line 220 of file GPALMail.cs.

◆ POPPortNum

int GenerallyPositive.GPALMail.POPPortNum
get

The port used to reach POPServerName.

Implements GenerallyPositive.IGPALMail.

Definition at line 308 of file GPALMail.cs.

◆ POPServerName

string GenerallyPositive.GPALMail.POPServerName
get

The POP server mail is read from, null when an IMAP server is the one named.

Implements GenerallyPositive.IGPALMail.

Definition at line 306 of file GPALMail.cs.

◆ Sent

DateTime? GenerallyPositive.GPALMail.Sent
get

When the last Send went out, null when it did not.

Implements GenerallyPositive.IGPALMail.

Definition at line 191 of file GPALMail.cs.

◆ SMTPPortNum

int GenerallyPositive.GPALMail.SMTPPortNum
get

The port used to reach SMTPServerName.

Implements GenerallyPositive.IGPALMail.

Definition at line 300 of file GPALMail.cs.

◆ SMTPServerName

string GenerallyPositive.GPALMail.SMTPServerName
get

The SMTP server mail is sent through, as set by WithSMTPServerName or read from a settings file.

Implements GenerallyPositive.IGPALMail.

Definition at line 298 of file GPALMail.cs.


The documentation for this class was generated from the following file: