I am developing a solution that queries PDF records from a WEB service. The result of consuming this service can be encrypted and stored as a PDF:
File.WriteAllBytes(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\prueba_" + cf.id_identificador + ".pdf", Convert.FromBase64String(tRespuesta.PDFResultado));
This PDF must be sent by email, which could be done by attaching it with the same path that was saved...
But saving the file and then consulting it increases the time a lot when the number of times this process is repeated is very large.
Is there a way to directly attach the webservice result without saving the file?
MailMessage email = new MailMessage();
email.To.Add(new MailAddress(destino));
email.From = new MailAddress("[email protected]");
email.Subject = "Asunto( " + DateTime.Now.ToString("dd / MMM / yyy hh:mm:ss") + " ) ";
//email.Attachments.Add();
email.Body = "Do not reply.";
email.IsBodyHtml = false;
email.Priority = MailPriority.High;
have you tried with
TransferEncoding