Esempio n. 1
0
        public void Send(EmailContents emailcontents)
        {
            SmtpClient client = new SmtpClient();//(will use the Web.config settings)
            // client.UseDefaultCredentials = true;
            MailAddress from = new MailAddress(emailcontents.FromEmailAddress, emailcontents.FromName);
            MailAddress to   = new MailAddress(emailcontents.To);

            MailMessage message = new MailMessage(from, to);

            message.Subject    = emailcontents.Subject;
            message.Body       = FormatText(emailcontents.Body, true);
            message.IsBodyHtml = true;
            message.Priority   = MailPriority.High;

            try
            {
                IsSent = false;
                client.Send(message);
                IsSent = true;
            }
            catch
            {
                //throw ex;
            }
        }
Esempio n. 2
0
        public void SendFax(string vFaxNumber)
        {
            try
            {
                IsFaxSent = false;
                net.interfax.ws.InterFax x = new net.interfax.ws.InterFax();
                long st = x.SendCharFax(this.OnlineFaxUserName, this.OnlineFaxPassword, this.FormatFaxNumber(vFaxNumber), this.FaxBody, "html");
                if (st > 0)
                {
                    IsFaxSent = true;
                }
            }
            catch (Exception ex)
            {
                IsFaxSent = false;
                EmailContents ec = new EmailContents();
                ec.FromEmailAddress = Globals.Settings.ContactForm.MailFrom;
                ec.FromName         = "FoodReady.net Fax";
                ec.Subject          = "New online order fax failed";
                ec.To   = Globals.Settings.ContactForm.MailTo;
                ec.Body = "<b>Online Fax Failed</b><br />Name: " + Name + " Phone: " + Phone + "<br /> OrderNumber: " + OrderNumber + " Total: " + Total + "<br /> Order Type: " + OrderType + " Payment Type: " + PaymentType;
                SmtpClient client = new SmtpClient();//(will use the Web.config settings)
                // client.UseDefaultCredentials = true;
                MailAddress from = new MailAddress(ec.FromEmailAddress, ec.FromName);
                MailAddress to   = new MailAddress(ec.To);

                MailMessage message = new MailMessage(from, to);

                message.Subject    = ec.Subject;
                message.Body       = FormatText(ec.Body, true);
                message.IsBodyHtml = true;
                message.Priority   = MailPriority.High;

                try
                {
                    IsSent = false;
                    client.Send(message);
                    IsSent = true;
                }
                catch
                {
                    return;
                }
            }
        }