From 0f5aa9a7f27e3e30ad2244cb8002f656c59e5679 Mon Sep 17 00:00:00 2001 From: amrita.vishnoi Date: Tue, 12 Sep 2017 17:09:31 +0530 Subject: [PATCH] report --- 400-SOURCECODE/AIAHTML5.API/Utility/EmailUtility.cs | 246 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------- 1 file changed, 123 insertions(+), 123 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.API/Utility/EmailUtility.cs b/400-SOURCECODE/AIAHTML5.API/Utility/EmailUtility.cs index 7b55008..50480e8 100644 --- a/400-SOURCECODE/AIAHTML5.API/Utility/EmailUtility.cs +++ b/400-SOURCECODE/AIAHTML5.API/Utility/EmailUtility.cs @@ -1,136 +1,136 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Configuration; -using System.Collections; -using System.Xml; -using System.Text; -using System.IO; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Configuration; +using System.Collections; +using System.Xml; +using System.Text; +using System.IO; using System.Net.Mail; -using log4net; - -namespace AIAHTML5.API.Utility -{ - - public class EmailUtility - { - public string sFromAddress { get; set; } - public List sToAddresses { get; set; } - public List sBccAddresses { get; set; } - public string sHostName { get; set; } - public string sSubject { get; set; } - public int iPort { get; set; } - public bool bEnableSsl { get; set; } - public string sUserName { get; set; } - public string sPassword { get; set; } - public bool bIsBodyHtml { get; set; } - public List sAttachments { get; set; } - public string sBodyText { get; set; } - public AlternateView sAlternateView { get; set; } - - public void SendMail(MailMessage mm) - { - SmtpClient smtp = new SmtpClient(); - smtp.Host = ConfigurationManager.AppSettings["SMTPAddress"]; - smtp.EnableSsl = Convert.ToBoolean(ConfigurationManager.AppSettings["EnableSSL"]); - System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential(mm.From.ToString(), ConfigurationManager.AppSettings["SenderPassword"]); - smtp.Credentials = NetworkCred; - smtp.Port = Convert.ToInt32(ConfigurationManager.AppSettings["SMTPPort"]); - - smtp.Send(mm); - } - - public void SendSmtpEmail() +using log4net; + +namespace AIAHTML5.API.Utility +{ + + public class EmailUtility + { + public string sFromAddress { get; set; } + public List sToAddresses { get; set; } + public List sBccAddresses { get; set; } + public string sHostName { get; set; } + public string sSubject { get; set; } + public int iPort { get; set; } + public bool bEnableSsl { get; set; } + public string sUserName { get; set; } + public string sPassword { get; set; } + public bool bIsBodyHtml { get; set; } + public List sAttachments { get; set; } + public string sBodyText { get; set; } + public AlternateView sAlternateView { get; set; } + + public void SendMail(MailMessage mm) + { + SmtpClient smtp = new SmtpClient(); + smtp.Host = ConfigurationManager.AppSettings["SMTPAddress"]; + smtp.EnableSsl = Convert.ToBoolean(ConfigurationManager.AppSettings["EnableSSL"]); + System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential(mm.From.ToString(), ConfigurationManager.AppSettings["SenderPassword"]); + smtp.Credentials = NetworkCred; + smtp.Port = Convert.ToInt32(ConfigurationManager.AppSettings["SMTPPort"]); + + smtp.Send(mm); + } + + public void SendSmtpEmail() { ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); - logger.Debug("inside SendSmtpEmail"); - - try - { - MailMessage sMail = new MailMessage(); - SmtpClient SmtpServer = new SmtpClient(sHostName); - string recipientEmailAddress = string.Empty; - - - if (sToAddresses != null) - { - foreach (var sItem in sToAddresses) - { + logger.Debug("inside SendSmtpEmail"); + + try + { + MailMessage sMail = new MailMessage(); + SmtpClient SmtpServer = new SmtpClient(sHostName); + string recipientEmailAddress = string.Empty; + + + if (sToAddresses != null) + { + foreach (var sItem in sToAddresses) + { sMail.To.Add(sItem); - logger.Debug("sToAddresses= " + sItem); - } - } - - if (sBccAddresses != null) - { - foreach (var sItem in sBccAddresses) - { + logger.Debug("sToAddresses= " + sItem); + } + } + + if (sBccAddresses != null) + { + foreach (var sItem in sBccAddresses) + { sMail.Bcc.Add(sItem); - logger.Debug("sBccAddresses= " + sItem); - - } - } - - sMail.IsBodyHtml = bIsBodyHtml; - - if (sAlternateView != null) - { + logger.Debug("sBccAddresses= " + sItem); + + } + } + + sMail.IsBodyHtml = bIsBodyHtml; + + if (sAlternateView != null) + { sMail.AlternateViews.Add(sAlternateView); - logger.Debug("sAlternateView= " + sAlternateView); - - } - else - { + logger.Debug("sAlternateView= " + sAlternateView); + + } + else + { sMail.Body = sBodyText; - logger.Debug("sMail.Body= " + sBodyText); - - } - + logger.Debug("sMail.Body= " + sBodyText); + + } + sMail.Subject = sSubject; - logger.Debug("sMail.Subject= " + sSubject); - - if (sAttachments != null) - { - foreach (var sItem in sAttachments) - { + logger.Debug("sMail.Subject= " + sSubject); + + if (sAttachments != null) + { + foreach (var sItem in sAttachments) + { sMail.Attachments.Add(sItem); - logger.Debug("sAttachments= " + sAttachments); - - - } + logger.Debug("sAttachments= " + sAttachments); + + + } } - logger.Debug("sUserName= " + sUserName + ", sPassword= " + sPassword); - - SmtpServer.Port = iPort; - SmtpServer.Credentials = new System.Net.NetworkCredential(sUserName, sPassword); - SmtpServer.EnableSsl = bEnableSsl; - - using (MailMessage mm = new MailMessage(sFromAddress, sMail.To.ToString())) - { - mm.Subject = sSubject; - mm.IsBodyHtml = bIsBodyHtml; - - if (sAlternateView != null) - { - mm.AlternateViews.Add(sAlternateView); - } - else - { - mm.Body = sBodyText; - } - - mm.IsBodyHtml = true; + logger.Debug("sUserName= " + sUserName + ", sPassword= " + sPassword); + + SmtpServer.Port = iPort; + SmtpServer.Credentials = new System.Net.NetworkCredential(sUserName, sPassword); + SmtpServer.EnableSsl = bEnableSsl; + + using (MailMessage mm = new MailMessage(sFromAddress, sMail.To.ToString())) + { + mm.Subject = sSubject; + mm.IsBodyHtml = bIsBodyHtml; + + if (sAlternateView != null) + { + mm.AlternateViews.Add(sAlternateView); + } + else + { + mm.Body = sBodyText; + } + + mm.IsBodyHtml = true; SendMail(mm); - logger.Debug("after sending email"); - } - - } - catch (Exception ex) + logger.Debug("after sending email"); + } + + } + catch (Exception ex) { - logger.Fatal("exception in SendSmtpEmail.msg= " + ex.Message + ", stacktarce= " + ex.StackTrace); - throw ex; - } - } - } + logger.Fatal("exception in SendSmtpEmail.msg= " + ex.Message + ", stacktarce= " + ex.StackTrace); + throw ex; + } + } + } } \ No newline at end of file -- libgit2 0.21.4