Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: ASP
Posted by: Mario Lopes
Added: Sep 19, 2018 4:34 PM
Views: 7
enviar um email com ficheiro
  1. MailMessage mail = new MailMessage();
  2.         mail.IsBodyHtml = true;
  3.         mail.From = new MailAddress("mails from");
  4.         mail.To.Add("mail to" );
  5.         mail.Subject = "Teste ";
  6.         mail.Body = "Envio ficheiro";
  7.         Attachment data = new Attachment("c:\\pentas\\bracelete.csv",MediaTypeNames.Application.Octet);
  8.         // your path may look like Server.MapPath("~/file.ABC")
  9.         mail.Attachments.Add(data);
  10.         SmtpClient smtp = new SmtpClient("smtp");
  11.         smtp.Credentials = new NetworkCredential("email", "passe");
  12.         smtp.Send(mail);