using eprintServer.Enums; using eprintServer.DTOs; using MailKit.Net.Smtp; using MailKit.Security; using MimeKit; namespace eprintServer.Services; public class EmailService { private readonly string _host = "ssl0.ovh.net"; private readonly int _port = 587; private readonly string _username = "test@camel-soft.com"; private readonly string _password = "sBXsr{C0=naNZ9(P~M=_"; public async Task SendReportEmailAsync(byte[] pdfFile, ReportDateEum reportType, string adminEmail) { var message = new MimeMessage(); message.From.Add(new MailboxAddress("Print Dashboard", _username)); message.To.Add(new MailboxAddress("Admin", adminEmail)); // Determine Subject based on Enum message.Subject = reportType switch { ReportDateEum.DAILY => "Daily print report", ReportDateEum.WEEKLY => "Weekly print report", ReportDateEum.MONTHLY => "Monthly print report", ReportDateEum.YEARLY => "Yearly print report", _ => "Print dashboard report" }; var bodyBuilder = new BodyBuilder { HtmlBody = $@"
Hello Admin,
Please find attached the requested statistics report for the Print Dashboard.
Best Regards,
Automated Reporting System