GPAL - Generally Positive Automation Library v1.0
GPAL The Fluent Automation LIbrary
Loading...
Searching...
No Matches
GPALMailSettings.cs
1// =============================================================================
2// GPAL - Generally Positive Automation Library
3// Copyright © 2026 Software Decisions, Inc. All rights reserved.
4//
5// This file is part of GPAL.
6// Licensed under the Business Source License 1.1
7//
8// Primary development, architecture, and vision by Michael B. Vederman,
9// CEO of Software Decisions, Inc., Texas.
10//
11// Internal development maintained privately.
12// Public releases appear on GitHub: https://github.com/SoftwareDecisionsInc/GPAL.
13//
14// See LICENSE for full terms, including Additional Use Grant.
15// =============================================================================
16
17using MimeKit;
18using System;
19using System.Collections.Generic;
20using System.Linq;
21using System.Text;
22using System.Threading.Tasks;
23
24namespace GenerallyPositive
25{
30 internal class GPALMailSettings
31 {
32 public string IMAPServerName { get; set; }
33 public string POPServerName { get; set; }
34 public string SMTPServerName { get; set; }
35 public int IMAPPortNum { get; set; }
36 public int POPPortNum { get; set; }
37 public int SMTPPortNum { get; set; }
38
39 // whether a send may fall back to accepting any certificate, including one that fails validation. Off,
40 // so a cert problem is a failure the workflow is told about rather than a silent downgrade to no
41 // verification. See GPALMail.WithAcceptAnyCertificate
42 public bool AcceptAnyCertificate { get; set; } = false;
43 // internal, because as a public MailboxAddress it went into the settings file as a whole MimeKit object
44 // - route, local part, domain and an entire Encoding with its fallbacks and code pages - and nothing
45 // could read that back
46 internal MailboxAddress FromEmailAddress { get; set; }
47
52 public string FromAddress
53 {
54 get
55 {
56 return FromEmailAddress?.ToString();
57 }
58 set
59 {
60 FromEmailAddress = true == string.IsNullOrWhiteSpace(value) ? null : MailboxAddress.Parse(value);
61 }
62 }
63 internal List<MailboxAddress> ToEmailAddresses { get; set; } = new List<MailboxAddress>();
64 internal List<MailboxAddress> CcEmailAddresses { get; set; } = new List<MailboxAddress>();
65 internal List<MailboxAddress> BccEmailAddresses { get; set; } = new List<MailboxAddress>();
66 internal List<string> Attachments { get; set; } = new List<string>();
67 internal string BodyText { get; set; }
68 internal string BodyHTML { get; set; }
69 internal string Subject { get; set; }
70 internal List<ReceivedEmail> ReceivedEmails { get; set; } = new List<ReceivedEmail>();
71
72 // what Receive is allowed to fetch. the whole mailbox by default, which is what it has always done
73 internal bool UnreadOnly { get; set; }
74 internal int MaxMessages { get; set; } = int.MaxValue;
75 // internal, so a settings file holds servers and ports and never who you are or your password. a
76 // credential is where those belong
77 internal string UserName { get; set; }
78 internal string Password { get; set; }
79 internal ICredentials Credentials { get; set; }
80 }
81}
82