Mail

Server Configuration

Methods for configuring SMTP, IMAP, and POP3 server settings used when sending or receiving email.

Methods for configuring SMTP, IMAP, and POP3 server settings used when sending or receiving email.

WithSMTPServerName and WithSMTPPortNum configure the outgoing mail server (default port 465). WithIMAPServerName and WithIMAPPortNum configure IMAP for receiving email (default port 993). WithPOPServerName and WithPOPPortNum configure POP3 for receiving email (default port 110). WithUserName and WithPassword set the authentication credentials. WithFromName sets the display name that appears as the sender. All server settings can be saved to and loaded from a file using SaveSettings and LoadSettings.

Examples

GPAL Fluent: High-level fluent C# API

//SaveSettings and LoadSettings let you store mail server configuration in a file and restore it without hardcoding credentials in your workflow. The config file format is GPAL's internal format - do not edit it manually.

// Configure SMTP for sending var mail = GPAL.Mail .WithSMTPServerName("smtp.example.com") .WithSMTPPortNum(587) .WithUserName("sender@example.com") .WithPassword("app-password") .WithFromName("GPAL Automation") .ToGPALObject(); // Save settings for reuse GPAL.Mail .WithSMTPServerName("smtp.example.com") .WithSMTPPortNum(587) .WithUserName("user@example.com") .WithPassword("pass") .SaveSettings("mail.config"); // Load saved settings GPAL.Mail .LoadSettings("mail.config");