Esempio n. 1
0
        public static void SendEmail(string[] emailAddresses, string body, string subject)
        {
            try
            {
                using (var client = new SmtpServiceClient("basicHttpEndPoint"))
                {
                    var oMessage = new SmtpMessage
                    {
                        From       = AppConfig.FromAddress,
                        Body       = body,
                        IsBodyHtml = true,
                        Subject    = subject,
                        To         = emailAddresses.ToArray()
                    };

                    try
                    {
                        client.Send2(oMessage);
                    }
                    catch (Exception exception)
                    {
                        LogEvent(exception, EventLogEntryType.Error);
                    }
                }
            }

            catch (Exception exception)
            {
                LogEvent(exception, EventLogEntryType.Error);
            }
        }
Esempio n. 2
0
 public static void SendEmail(string messageBody, string toAddress, string subject)
 {
     using (var client = new SmtpServiceClient("basicHttpEndPoint"))
     {
         var oMessage = new SmtpMessage
         {
             From       = String.Format("{0}@SARS.GOV.ZA", SARSDataSettings.Settings.ApplicationName).ToUpper(),
             Body       = messageBody,
             IsBodyHtml = true,
             Subject    = subject,
             To         = new[] { toAddress }
         };
         client.Send2(oMessage);
     }
 }
Esempio n. 3
0
    public static void SendEmail(string[] emailAddresses, string body, string subject)
    {
        using (var client = new SmtpServiceClient("basicHttpEndPoint"))
        {
            var oMessage = new SmtpMessage
            {
                From       = Configurations.FromAddress,
                Body       = body,
                IsBodyHtml = true,
                Subject    = subject,
                To         = emailAddresses.ToArray()
            };


            client.Send2(oMessage);
            client.Close();
        }
    }