using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
///
/// Summary description for EcoMail
///
public class EcoMail
{
public EcoMail()
{
//
// TODO: Add constructor logic here
//
}
public static void sendMail(string strName, string strTitle, string strCompany, string strSector, string strAddress, string strCity, string strSelect1, string strEmail, string strPhone, string strMobile, string strComment, bool CheckBox1)
{
string strHost = "localhost";
string strBody = "
" +
"" +
"" +
"| " +
"Name: " + strName+
" | "+
"
"+
"" +
"| " +
"Title: " + strTitle +
" | " +
"
" +
"" +
"| " +
"Company: " + strCompany +
" | " +
"
" +
"" +
"| " +
"Sector: " + strSector +
" | " +
"
" +
"" +
"| " +
"Address: " + strAddress +
" | " +
"
" +
"" +
"| " +
"City: " + strCity +
" | " +
"
" +
"" +
"| " +
"Governorate: " + strSelect1 +
" | " +
"
" +
"" +
"| " +
"E-Mail: " + strEmail+
" | " +
"
" +
"" +
"| " +
"Phone: " + strPhone+
" | " +
"
" +
"" +
"| " +
"Mobile: " + strMobile +
" | " +
"
" +
"" +
"| " +
"Comment: " + strComment +
" | " +
"
" +
"" +
"| " +
"Want to join our mailing List: " + CheckBox1.ToString() +
" | " +
"
" +
"
"+
"";
System.Web.Mail.MailMessage msg = new System.Web.Mail.MailMessage();
msg.BodyFormat = System.Web.Mail.MailFormat.Html;
msg.From = strEmail;
msg.To = ConfigurationManager.AppSettings["EcoMail"];
msg.Body = strBody;
msg.Subject = "Incoming Web Form Application";
System.Net.Mail.MailMessage m = new System.Net.Mail.MailMessage(ConfigurationManager.AppSettings["EcoMail"], ConfigurationManager.AppSettings["EcoMailTo"]);
m.Body = strBody;
m.IsBodyHtml = true;
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
client.Send(m);
//System.Web.Mail.SmtpMail.SmtpServer = ConfigurationManager.AppSettings["SMTPMail"]; ;
//System.Web.Mail.SmtpMail.Send(msg);
//System.Web.Mail.SmtpMail.Send(strEmail, emailTO, Compnay, strBody);
}
}