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
|
protected void Button1_Click(object sender, EventArgs e)
{
ResourceManager rm = new ResourceManager("DemandeIntervention.mail", System.Reflection.Assembly.GetExecutingAssembly());
CultureInfo fr = new CultureInfo("fr");
/*string message = "sse";
Response.Write("<body><script>alert(\"" + message + "\");</script></body>");
// ScriptManager.RegisterStartupScript(Page,GetType(),"mon_alert", "mon_alert()",true); */
MailMessage theMail = new MailMessage();
theMail.Subject = String.Format("{0}", rm.GetString("Subject", fr));
MailAddressCollection Address = new MailAddressCollection();
//Address.Add(new MailAddress(ConfigurationManager.AppSettings["mail_to"]));
Address.Add(new MailAddress("xlasbats@potez.com"));
theMail.To.Add(Address[0]);
theMail.From = new MailAddress(ConfigurationManager.AppSettings["mail_from"]);
theMail.Body = String.Format("{16} : \n\n{0} {1}\n{2} : {3}\n\n{4} : {5}\n\n{6} : {7}\n\n{8} : {9} \n\n{10} : {11}\n\n{12} : {13}\n\n{14} {15}",
LabelDemandeur.Text, lblDemandeur.Text,
LabelDate.Text, lblDate.Text,
LabelBatiment.Text, DDBatiment.SelectedItem.Text,
LabelZone.Text, DDZone.SelectedItem.Text,
LabelEquipement.Text, TBNumEquipement.Text,
LabelDemande.Text, TBDemande.Text,
LabelDescrDem.Text, TBDescrDem.Text,
LabelDateLim.Text, TBDateLim.Text,
rm.GetString("BodyEnTete", fr)
);
SmtpClient smtpClient = new SmtpClient(ConfigurationManager.AppSettings["mail_server"]);
smtpClient.Send(theMail);
string message ="La fiche a bien été transmise.";
MessageBox.Show(message,"Confirmation Envoi e-mail");
// Response.Write(@"<script language=JavaScript>alert('La fiche a bien été transmise.');</script>");
// ScriptManager.RegisterStartupScript(this, typeof(Page), "Message", "alert('TON MESSAGE');", true);
Response.Redirect("DemandeIntervention.aspx");
} |