protected void MailSend(string from, string to, string subject, string body) { //Test Email Data string strdir = "D:\\TEMP\\"; string AttFileName = Label2.Text.ToString(); string filelocation = strdir + AttFileName; //client = new SmtpClient(); //client.Host = "localhost"; //client.Port = 25; try { bool T1; GoofyMailSender mail = new GoofyMailSender("localhost"); T1 = mail.SendMailWithAttachment(to, from, subject, body, ""); if (T1 == false) { Response.Write("<script>alert('Email address Error, Your Mail do not send,Please check recipient mail '); </script>"); } else { if (PDFCheckBox.Checked == true) { mail.AttachFile(filelocation); } mail.MailSend(); updateEmailhistory(to, subject, body, from); //File.Delete(filelocation); } } catch { //File.Delete(filelocation); Response.Write("<script>alert('Email address Error, Your Mail do not send '); indow.close();</script>"); } finally { Response.Write("Your E-mail has been sent sucessfully"); Response.Write("<script>window.close();</script>"); } }
protected void PDFAttchFile(int rowIndex, string HAWB) { string strdir = "D:\\TEMP\\"; // Get HAWB Checkbox CheckBox HAWBox = (CheckBox)GridViewHAWB.Rows[rowIndex].FindControl("HAWBCheckBox"); if (HAWBox.Checked == true) { //PDFFILE Location string PdfFile = strdir + elt_account_number + "shippermail" + HAWB + ".pdf"; try { //PDF file attach//////////////////////////////////////////////////// //Response.Write("<script> window.open('/ASP/ajaxFunctions/ajax_EMAIL_Fileattchment.asp?mode=send&HAWB=" + HAWBNO.Value.ToString() + "');</script>"); msg.AttachFile(PdfFile); // attacment file//////////////////////////////////////////////// } catch { emailError = "Y"; } } }