12345678910111213141516171819202122232425262728293031323334 |
- using Microsoft.Extensions.Configuration;
- using System.Collections.Generic;
- using XYY.Common.Standard;
- namespace XYY.Service.Strandard.EMailService
- {
- public interface IEmailService
- {
- void Send(List<string> receivers, string subject, string body, bool isHtml, List<string>? bc);
- }
- public class EmailService : IEmailService
- {
- private readonly string smptHost;
- private readonly string sender;
- private readonly string senderName;
- private readonly string password;
- private readonly int port;
- public EmailService(IConfiguration configuration)
- {
- smptHost = configuration["Email:smtp"];
- sender = configuration["Email:sender"];
- password = configuration["Email:password"];
- senderName = configuration["Email:senderName"];
- port = int.Parse(configuration["Email:port"]);
- }
- public void Send(List<string> receivers, string subject, string body, bool isHtml, List<string>? bc)
- {
- EmailHelper.SendEmail(senderName, sender, smptHost, port, password, receivers, bc, subject, body, isHtml);
- }
- }
- }
|