/// <summary> /// sends a mail /// </summary> /// <param name="aMail"></param> public void sendMail_Net(MailData aMail) { MailMessage oMsg = new MailMessage(); // Set the message sender oMsg.From = new MailAddress(aMail.from, aMail.fromName); // The .To property is a generic collection, // so we can add as many recipients as we like. oMsg.To.Add(new MailAddress(aMail.to, aMail.toName)); //if the mail is sent with cc in recipients if (aMail.CCto != null) { if (aMail.CCto.Contains(";")) { string[] mailarr = aMail.CCto.Split(';'); for (int i = 0; i < mailarr.Length; i++) { oMsg.CC.Add(mailarr[i]); } } else { oMsg.CC.Add(aMail.CCto); } } // Set the content //Subject of the mail oMsg.Subject = aMail.subject; //Body of the mail oMsg.Body = aMail.bodyMessage; //set if the mail is html or not oMsg.IsBodyHtml = true; //set mail credentials like smtpserver, username and password for authentication //SmtpClient oSmtp = new SmtpClient("gcell-in-smtp.mail.lotuslive.com", 465); //oSmtp.EnableSsl = true; //System.Net.NetworkCredential credentials = new NetworkCredential("*****@*****.**", "HSLPS@7788"); //SmtpClient oSmtp = new SmtpClient("smtp.gmail.com", 587); SmtpClient oSmtp = new SmtpClient("smtp.gmail.com", 25); oSmtp.EnableSsl = true; System.Net.NetworkCredential credentials = new NetworkCredential("*****@*****.**", "gcell@123"); oSmtp.UseDefaultCredentials = false; oSmtp.Credentials = credentials; try { oSmtp.Send(oMsg); } catch (Exception EX) { } finally { } }
/// <summary> /// sends a mail /// </summary> /// <param name="aMail"></param> public void sendMail_Net(MailData aMail) { MailMessage oMsg = new MailMessage(); // Set the message sender oMsg.From = new MailAddress(aMail.from, aMail.fromName); // The .To property is a generic collection, // so we can add as many recipients as we like. oMsg.To.Add(new MailAddress(aMail.to, aMail.toName)); //if the mail is sent with cc in recipients if (aMail.CCto != null) { if (aMail.CCto.Contains(";")) { string[] mailarr = aMail.CCto.Split(';'); for (int i = 0; i < mailarr.Length; i++) oMsg.CC.Add(mailarr[i]); } else oMsg.CC.Add(aMail.CCto); } // Set the content //Subject of the mail oMsg.Subject = aMail.subject; //Body of the mail oMsg.Body = aMail.bodyMessage; //set if the mail is html or not oMsg.IsBodyHtml = true; //set mail credentials like smtpserver, username and password for authentication //SmtpClient oSmtp = new SmtpClient("gcell-in-smtp.mail.lotuslive.com", 465); //oSmtp.EnableSsl = true; //System.Net.NetworkCredential credentials = new NetworkCredential("*****@*****.**", "HSLPS@7788"); //SmtpClient oSmtp = new SmtpClient("smtp.gmail.com", 587); SmtpClient oSmtp = new SmtpClient("smtp.gmail.com", 25); oSmtp.EnableSsl = true; System.Net.NetworkCredential credentials = new NetworkCredential("*****@*****.**", "gcell@123"); oSmtp.UseDefaultCredentials = false; oSmtp.Credentials = credentials; try { oSmtp.Send(oMsg); } catch (Exception EX) { } finally { } }
public void SendMailKOD(MailData aMail) { MailMessage oMsg = new MailMessage(); oMsg.From = new MailAddress(aMail.from, aMail.fromName); oMsg.To.Add(new MailAddress(aMail.to, aMail.toName)); //if the mail is sent with cc in recipients if (aMail.CCto != null) { if (aMail.CCto.Contains(";")) { string[] mailarr = aMail.CCto.Split(';'); for (int i = 0; i < mailarr.Length; i++) { oMsg.CC.Add(mailarr[i]); } } else { oMsg.CC.Add(aMail.CCto); } } oMsg.Subject = aMail.subject; oMsg.Body = aMail.bodyMessage; Attachment at = new Attachment(System.Web.HttpContext.Current.Server.MapPath("~/Skins/images/Royal Card Grid.png")); oMsg.Attachments.Add(at); oMsg.IsBodyHtml = true; SmtpClient oSmtp = new SmtpClient("smtp.qlc.co.in", 25); //oSmtp.EnableSsl = true; System.Net.NetworkCredential credentials = new NetworkCredential("17230_thegreat_smtp", "t1h2e3g4"); oSmtp.UseDefaultCredentials = false; oSmtp.Credentials = credentials; try { oSmtp.Send(oMsg); } catch (Exception EX) { } finally { } }
protected void MailToUser(String ToMail, String ToName) { MailServer objMail = new MailServer(); MailData objmaildata = new MailData(); objmaildata.from = "*****@*****.**"; objmaildata.fromName = "*****@*****.**"; objmaildata.to = ToMail.ToString(); //objmaildata.to = "*****@*****.**"; objmaildata.toName = "Royal Card Feedback: Mail"; objmaildata.subject = "Royal Card Feedback Mail"; string BodyMaggage = "<p>Dear " + ToName.ToString() + ",</p>" + "<p> Thanks for your kind Feedback </p>" + "<p>We will get back to you soon</p>" + "<p>Regards</p><p> KOD ROYAL CARD TEAM </p>" ; objmaildata.bodyMessage = BodyMaggage; objMail.sendMail_Net(objmaildata); }
protected void MailToAdmin(String FromMail) { MailServer objMail = new MailServer(); MailData objmaildata = new MailData(); objmaildata.from = FromMail.ToString(); objmaildata.fromName = FromMail.ToString(); objmaildata.to = "*****@*****.**"; //objmaildata.to = "*****@*****.**"; //objmaildata.to = "*****@*****.**"; objmaildata.toName = "Royal Card Feedback: Mail"; objmaildata.subject = "Royal Card Feedback Mail"; string BodyMaggage = ""; if (Session["RegId"].ToString() == "" || Session["RegId"] == null) { BodyMaggage = "<p>Dear Admin</p>" + "<p> Name : " + txtFirstName.Text.ToString() + "</p>" + "<p> Email Id: " + FromMail.ToString() + "</p>" + "<p> Mobile No. : " + txtmobile.Text.ToString() + "</p>" + "<p> Topic : " + Rdtopic.SelectedItem.Text.ToString() + "</p>" + "<p> Comment: " + txtComments.Text.ToString() + "</p>" + "<p>Regards</p><p> " + txtFirstName.Text.ToString() + "</p>" ; } else { BodyMaggage = "<p> Member ID: " + Session["RegId"].ToString() + "</p>" + "<p> Name : " + txtFirstName.Text.ToString() + "</p>" + "<p> Email Id: " + FromMail.ToString() + "</p>" + "<p> Mobile No. : " + txtmobile.Text.ToString() + "</p>" + "<p> Topic : " + Rdtopic.SelectedItem.Text.ToString() + "</p>" + "<p> Comment: " + txtComments.Text.ToString() + "</p>" + "<p>Regards</p><p> " + Session["RegId"].ToString() + "</p>" ; } objmaildata.bodyMessage = BodyMaggage; objMail.sendMail_Net(objmaildata); }
public void SendMailKOD(MailData aMail) { MailMessage oMsg = new MailMessage(); oMsg.From = new MailAddress(aMail.from, aMail.fromName); oMsg.To.Add(new MailAddress(aMail.to, aMail.toName)); //if the mail is sent with cc in recipients if (aMail.CCto != null) { if (aMail.CCto.Contains(";")) { string[] mailarr = aMail.CCto.Split(';'); for (int i = 0; i < mailarr.Length; i++) oMsg.CC.Add(mailarr[i]); } else oMsg.CC.Add(aMail.CCto); } oMsg.Subject = aMail.subject; oMsg.Body = aMail.bodyMessage; Attachment at = new Attachment(System.Web.HttpContext.Current.Server.MapPath("~/Skins/images/Royal Card Grid.png")); oMsg.Attachments.Add(at); oMsg.IsBodyHtml = true; SmtpClient oSmtp = new SmtpClient("smtp.qlc.co.in", 25); //oSmtp.EnableSsl = true; System.Net.NetworkCredential credentials = new NetworkCredential("17230_thegreat_smtp", "t1h2e3g4"); oSmtp.UseDefaultCredentials = false; oSmtp.Credentials = credentials; try { oSmtp.Send(oMsg); } catch (Exception EX) { } finally { } }
protected void MailToAdmin(String FromMail) { MailServer objMail = new MailServer(); MailData objmaildata = new MailData(); objmaildata.from = FromMail.ToString(); objmaildata.fromName = FromMail.ToString(); objmaildata.to = "*****@*****.**"; //objmaildata.to = "*****@*****.**"; //objmaildata.to = "*****@*****.**"; objmaildata.toName = "Royal Card Feedback: Mail"; objmaildata.subject = "Royal Card Feedback Mail"; string BodyMaggage = ""; if (Session["RegId"].ToString() == "" || Session["RegId"] == null) { BodyMaggage = "<p>Dear Admin</p>" +"<p> Name : "+txtFirstName.Text.ToString()+"</p>" +"<p> Email Id: " + FromMail.ToString() + "</p>" + "<p> Mobile No. : " + txtmobile.Text.ToString() + "</p>" + "<p> Topic : " + Rdtopic.SelectedItem.Text.ToString() + "</p>" + "<p> Comment: " + txtComments.Text.ToString() + "</p>" + "<p>Regards</p><p> " + txtFirstName.Text.ToString() + "</p>" ; } else { BodyMaggage = "<p> Member ID: " + Session["RegId"].ToString() + "</p>" + "<p> Name : " + txtFirstName.Text.ToString() + "</p>" + "<p> Email Id: " + FromMail.ToString() + "</p>" + "<p> Mobile No. : " + txtmobile.Text.ToString() + "</p>" + "<p> Topic : " + Rdtopic.SelectedItem.Text.ToString() + "</p>" + "<p> Comment: " + txtComments.Text.ToString() + "</p>" + "<p>Regards</p><p> " + Session["RegId"].ToString() + "</p>" ; } objmaildata.bodyMessage = BodyMaggage; objMail.sendMail_Net(objmaildata); }