From cb988e2e4dfae9d811eef3a7cebcf6825bb2556c Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Sun, 15 Oct 2023 14:48:54 +0700 Subject: [PATCH] test send mail --- .../Repositories/Commands/CommandRepository.cs | 5 +++++ .../Controllers/OrderController.cs | 16 ++++++++++++++++ BMA.EHR.Command.Service/appsettings.json | 6 +++--- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs b/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs index 0bb4105a..8ba19a0d 100644 --- a/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs +++ b/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs @@ -71,6 +71,11 @@ namespace BMA.EHR.Application.Repositories.Commands #region " Methods " + public void SendMail() + { + _emailSenderService.SendMail("test", "test", "suphonchai@frappet.com"); + } + #region " Private " #region " List Receiver " diff --git a/BMA.EHR.Command.Service/Controllers/OrderController.cs b/BMA.EHR.Command.Service/Controllers/OrderController.cs index 3ab913ce..d69a5b15 100644 --- a/BMA.EHR.Command.Service/Controllers/OrderController.cs +++ b/BMA.EHR.Command.Service/Controllers/OrderController.cs @@ -106,6 +106,22 @@ namespace BMA.EHR.Command.Service.Controllers #region " Methods " + [HttpGet("mail")] + [AllowAnonymous] + public async Task> SendMail() + { + try + { + _repository.SendMail(); + + return Success(); + } + catch(Exception ex) + { + return Error(ex); + } + } + #region " Add Watermark " private void AddWaterMarkText(PdfContentByte pdfData, string watermarkText, BaseFont font, float fontSize, float angle, BaseColor color, Rectangle realPageSize) diff --git a/BMA.EHR.Command.Service/appsettings.json b/BMA.EHR.Command.Service/appsettings.json index ab241292..15176974 100644 --- a/BMA.EHR.Command.Service/appsettings.json +++ b/BMA.EHR.Command.Service/appsettings.json @@ -37,9 +37,9 @@ }, "Mail": { "Server": "smtp.gmail.com", - "User": "suphonchai.ph@gmail.com", - "Password": "nnjazjcnwhepkxdm", - "MailFrom": "suphonchai.ph@gmail.com", + "User": "exambkk2@gmail.com", + "Password": "nqruwmgtwfanoccm", + "MailFrom": "exambkk2@gmail.com", "Port": "587" }, "API": "https://bma-ehr.frappet.synology.me/api/v1"