Mail

Send, Receive, and Utilities

Methods for sending the composed message, receiving incoming messages, clearing the current message configuration, and parsing email address strings.

Methods for sending the composed message, receiving incoming messages, clearing the current message configuration, and parsing email address strings.

Send transmits the composed message using the configured SMTP server. Receive retrieves incoming messages from the configured IMAP or POP3 server. Clear resets the message envelope (from, to, subject, body, attachments) while keeping server settings - useful for sending multiple messages in sequence. WithName assigns a friendly identifier to this mail instance for logging. ParseEmailAddresses is a static utility that parses a comma-separated string of addresses into a List<MailboxAddress>.

Examples

GPAL Fluent: High-level fluent C# API

//Call Clear() between messages when reusing the same mail object. Server settings (server name, port, credentials) are preserved by Clear() - only the message envelope is reset.

// Send multiple messages without reinitializing the server var mail = GPAL.Mail .WithSMTPServerName("smtp.example.com") .WithSMTPPortNum(587) .WithUserName("sender@example.com") .WithPassword("pass") .ToGPALObject(); foreach (var recipient in recipients) { mail .WithFromEmailAddress("sender@example.com") .WithToEmailAddress(recipient) .WithSubject("Your report") .WithBody("Attached.") .Send() .Clear(); } // Parse addresses from a comma-separated string var addresses = GPALMail.ParseEmailAddresses("alice@ex.com, bob@ex.com");