private static string ToRawData(MailMessage message)
 {
     using (var stream = new MemoryStream())
     {
         MailMessageSerializer.Serialize(message, stream);
         return(Uri.EscapeDataString(Convert.ToBase64String(stream.ToArray())));
     }
 }
Ejemplo n.º 2
0
 private static SendRawEmailRequest ConvertMessageToRequest(MailMessage mailMessage)
 {
     using (var stream = new MemoryStream())
     {
         MailMessageSerializer.Serialize(mailMessage, stream);
         return(new SendRawEmailRequest(new RawMessage(stream))
         {
             Destinations = mailMessage.To.AsEnumerable().Select(x => x.Address).ToList(),
             Source = mailMessage.From.Address
         });
     }
 }