1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| string centre_secour = ListCS.SelectedItem.Text;
string course = ListCourse.SelectedItem.Text;
string trasnport = ListTransport.SelectedItem.Text;
string motif = ListMotif.SelectedItem.Text;
string lieu = Listintervention.SelectedItem.Text;
string date = TextDate.Text;
string appel = TextAppel.Text;
string depart = TextDepart.Text;
string place = TextSurPlace.Text;
string charge = TextEnCharge.Text;
string hospital = TextAdresseHopital.Text;
string localHosp = ListLocaliteHopitale.SelectedItem.Text;
string destination = TextDestination.Text;
string chauffeur = ListChauffeur.SelectedItem.Text;
string Conv1 = ListConv.SelectedItem.Text;
string Conv2 = ListConv2.SelectedItem.Text;
string KM = TextKM.Text;
string nom = TextNomPatient.Text;
string prenom = TextPrenom.Text;
string anniversaire = TextAnniversaire.Text;
string sexe = ListSexe.SelectedItem.Text;
string domicile = TextDomicile.Text;
string localpatient = ListLocalePatient.SelectedItem.Text;
string libelle = TextLibelle.Text;
string adressefactu = TextFacturation.Text;
string localfactu = ListFacturation.SelectedItem.Text;
MemoryStream pdfStream = new PDFForm().ExportPDF(centre_secour, date, course, trasnport, motif, appel, depart, lieu, place, charge, hospital, localHosp,
destination, chauffeur, Conv1, Conv2, KM, nom, prenom, anniversaire, sexe, domicile, localpatient, libelle, adressefactu, localfactu);
pdfStream.Position = 0;
MailMessage mailMessage = new MailMessage();
SmtpClient smtpClient = new SmtpClient("localhost");
mailMessage.To.Add("rob@rnwood.co.uk");
mailMessage.From = new MailAddress("noreaply@croix-rouge.be");
mailMessage.Subject = "ASP.NET e-mail test";
mailMessage.Body = "Hello world,\n\nThis is an ASP.NET test e-mail!";
System.Net.Mime.ContentType ct = new System.Net.Mime.ContentType("application/pdf");
System.Net.Mail.Attachment attachment;
attachment = new System.Net.Mail.Attachment(pdfStream, ct);
mailMessage.Attachments.Add(attachment);
smtpClient.Send(mailMessage);
pdfStream.Close();
Response.Write("E-mail sent!");
}
catch (Exception ex)
{
Response.Write("Could not send the e-mail - error: " + ex.Message);
} |
Partager