Пример #1
0
 public void SendMessage(EmailMessage pMessage)
 {
     EmailService.EmailServiceClient lClient = new EmailService.EmailServiceClient();
     lClient.SendEmail(
         new EmailService.EmailMessage()
         {
             Message = pMessage.Message,
             ToAddresses = pMessage.ToAddress,
             Date = DateTime.Now
         }
         );
 }
Пример #2
0
        public ActionResult <string> Get(int id)
        {
            var host = _configuration["ServiceUrl:EmailGrpc"];//127.0.0.1:5001

            Channel channel = new Channel(host, ChannelCredentials.Insecure);

            var client = new EmailService.EmailServiceClient(channel);

            var reply = client.SendEmail(new Messages.EmailGrpcService.SendEmailRequest {
                Address = "*****@*****.**"
            });

            channel.ShutdownAsync().Wait();
            return("xong");
        }
Пример #3
0
 private void SendEmail(string pdfPath, string to, string folder)
 {
     using (var email = new EmailService.EmailServiceClient())
     {
         email.SendEmail("Registro de Cliente", new EmailService.EmailDto
         {
             Tok__BackingField   = new string[] { to },
             Bodyk__BackingField = string.Format("Aqui está o email com as informações do seu cadastro. \n"
                                                 + "Segue o link para download dos arquivos {0}",
                                                 ConfigurationManager.AppSettings.Get("serverPath") + folder), //"Aqui está o seu email com as informações do cadastro",
             Subjectk__BackingField    = "Informações do Cadastro",
             Attachmentk__BackingField = new EmailService.AttachmentDto
             {
                 _content  = System.IO.File.ReadAllBytes(pdfPath),
                 _filename = new FileInfo(pdfPath).Name
             }
         });
     }
 }