CertificateEmailer¶
A static helper that composes and sends the standard certificate-of-coverage notification email — a fixed HTML body plus a PDF attachment built from the supplied stream — to a list of recipient addresses, delegating the actual send to an injected IEmailService.
Purpose¶
- Builds the standard SAIF "Certificate of Coverage" HTML email body, including the SAIF branding image and confidentiality notice.
- Attaches the certificate document (from the given
Stream) to each outgoing message as a PDF namedCertificateOfCoverage.pdf. - Sends one email per address in the recipient list via
IEmailService.SendEmail, resetting the stream position after each send so it can be reused for the next recipient.
Context¶
- Namespace:
SAIF.Services.Policies.Certificates - Assembly/package:
SAIF.Services(packaged inside theSAIF.SAIFCode.CoreNuGet package).
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| SendEmailstoStakeHolders | public static void SendEmailstoStakeHolders(IEmailService emailService, IEnumerable<string> emailAddressList, Stream stream, string emailSubjectLine = "Certificate of Coverage") |
For each address in emailAddressList, builds a MailMessage from certs@saif.com with the fixed HTML body and the given (or default) subject, attaches the stream content as CertificateOfCoverage.pdf, sends it through emailService, and rewinds the stream to position 0 for reuse. |
Behavioral notes¶
- The class carries a
CA1053:StaticHolderTypesShouldNotHaveConstructorssuppression, confirming its intended use is as a static holder despite exposing an implicit public constructor.* - The HTML body text (SAIF branding, contact number, and confidentiality notice) is hard-coded and identical for every send; only the subject line varies per call.
- Does not dispose the constructed
MailMessage/Attachmentobjects explicitly; aCA2000:Dispose objects before losing scopesuppression is present on the method, indicating this is a known, accepted trade-off rather than an oversight.* - Because the same
streamis reused across all recipients (with position reset to 0 after each send), callers must not dispose or advance the stream themselves between calls.*
Constraints and usage notes¶
emailService,emailAddressList, andstreamare not null-checked inside the method (per theCA1062suppressions on the parameters), so callers are responsible for passing valid, non-null arguments.*- Intended to be invoked by other certificate services (e.g.
CertificateDistributionService) rather than called directly by UI/controller code.*
Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.
Sources¶
Services/SAIF.Services/Policies/Certificates/CertificateEmailer.cs