Пример #1
0
        //function to send email
        public static void Send(string sTo, string sCC, string sFrom, string sSubject, string sBody, List <string> lGaugeAttachment, string sEmailAttachment)
        {
            var sErrorEmail = Object_Fido_Configs.GetAsString("fido.email.erroremail", null);
            var sFidoEmail  = Object_Fido_Configs.GetAsString("fido.email.fidoemail", null);
            var sSMTPServer = Object_Fido_Configs.GetAsString("fido.email.smtpsvr", null);

            try
            {
                var mMessage = new MailMessage {
                    IsBodyHtml = true
                };

                mMessage.AddRecepients(sTo, sCC);

                mMessage.AddMain(sFrom, sSubject, sBody, lGaugeAttachment);


                if (!string.IsNullOrEmpty(sEmailAttachment))
                {
                    var sAttachment = new Attachment(sEmailAttachment);

                    mMessage.Attachments.Add(sAttachment);
                }

                mMessage.SendMessage();
            }
            catch (Exception e)
            {
                Send(sErrorEmail, sFidoEmail, sFidoEmail, "Fido Error", "Fido Failed: Generic error sending email." + e, null, null);
                throw;
            }
        }