Пример #1
0
        public void Send(EmailContents emailContents)
        {
            SmtpClient client = new SmtpClient(SMTPServerName);
            client.UseDefaultCredentials = true;
            MailAddress from = new MailAddress(emailContents.FromEmailAddress, emailContents.FromName);
            MailAddress to = new MailAddress(ToAddress);
            MailAddress bcc = new MailAddress(emailContents.Bcc);
            MailAddress cc = new MailAddress(emailContents.Cc);
            MailMessage message = new MailMessage(from, to);

            message.Bcc.Add(bcc);
            message.CC.Add(cc);
            message.Subject = emailContents.Subject;
            message.Body = Utilities.FormatText(emailContents.Body, true);
            message.IsBodyHtml = true;

            try
            {
                client.Send(message);
                IsSent = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
    protected void btnRefund_Click( object sender , EventArgs e )
    {
        PayPalManager payPal = new PayPalManager();
        payPal.RefundTransaction( Request.QueryString[ "TransId" ] );

        Orders orders = new Orders();
        ProcessUpdateOrder updateOrder = new ProcessUpdateOrder();

        int refundedstatustype = 3;

        orders.OrderId = int.Parse( Request.QueryString["OrderId"] );
        orders.OrderStatusId = refundedstatustype;
        orders.ShipDate = ( DateTime ) SqlDateTime.Null;
        updateOrder.Orders = orders;

        try
        {
            updateOrder.Invoke();

            if (payPal.IsSubmissionSuccess)
            {
                EmailManager emailMngr = new EmailManager();
                EmailContents mailContents = new EmailContents();

                mailContents.To = Request.QueryString["Email"];
                mailContents.Bcc = EmailAddressConstants.Simon;
                mailContents.Subject = "Live Free Range Update - Order ID: " + Request.QueryString["OrderID"];
                mailContents.Body = "Your order has been refunded.  Please log into your account for details.";
                mailContents.FromEmailAddress = EmailAddressConstants.Contact;

                emailMngr.Send(mailContents);

                if (!emailMngr.IsSent)
                {
                    Response.Redirect("../ErrorPage.aspx");
                }
            }
        }
        catch(Exception ex)
        {
            Response.Redirect("../ErrorPage.aspx");
        }

        Response.Redirect("Orders.aspx");
    }
Пример #3
0
    private void SendMessage()
    {
        if (IsValid)
        {
            EmailContents contents = new EmailContents();
            contents.FromName = this.txtName.Text;
            contents.FromEmailAddress = this.txtEmail.Text;
            contents.Body = this.txtComment.Text;
            contents.Subject = "Website Feedback";

            EmailManager emailMngr = new EmailManager();
            emailMngr.Send(contents);

            if (emailMngr.IsSent)
            {
                Response.Redirect("ContactUsConfirm.aspx");
            }
        }
    }
Пример #4
0
        public void SendNewsletter()
        {
            string msgBody = string.Empty;
            string unsubscribe = string.Empty;
            EmailManager mailManager = new EmailManager();
            EmailContents mailContents = new EmailContents();

            using (StreamReader sr = new StreamReader(HttpContext.Current.Server.MapPath("~/Admin/EmailTemplates/CustomerNewsletter.htm")))
            {
                string stringBody = sr.ReadToEnd();

                foreach (DataRow dr in UserData.Tables[0].Rows)
                {
                    msgBody = stringBody;

                    unsubscribe = "<a href =\"http://www.livefreerange.co.uk/Admin/Unsubscribe.aspx?EndUserId=" + dr["EndUserId"].ToString() + "?FullName=" + dr["FirstName"].ToString() + " " + dr["LastName"].ToString() + "\"Target=\"_blank\"\">Click here</a>";

                    msgBody = msgBody.Replace("'+Name+", dr["FirstName"].ToString() + " " + dr["LastName"].ToString());
                    msgBody = msgBody.Replace("'+MessageBody+", MessageBody);
                    msgBody = msgBody.Replace("'+Clickhere+", unsubscribe);

                    mailContents.To = dr["Email"].ToString();
                    mailContents.FromName = "Live Free Range";
                    mailContents.FromEmailAddress = "*****@*****.**";
                    mailContents.Subject = "Newsletter";
                    mailContents.Body = msgBody;

                    mailManager.Send(mailContents);
                }
            }
        }
Пример #5
0
    protected void btnUpdate_Click( object sender , EventArgs e )
    {
        Orders orders = new Orders();
        ProcessUpdateOrder updateOrder = new ProcessUpdateOrder();

        orders.OrderId = int.Parse( Request.QueryString["OrderId"] );
        orders.OrderStatusId = int.Parse( ddlOrderStatus.SelectedItem.Value );
        orders.ShipDate = Convert.ToDateTime( txtShippedDate.Text );
        orders.TrackingNumber = txtTrackingNumber.Text;

        updateOrder.Orders = orders;

        try
        {
            updateOrder.Invoke();

            EmailManager emailMngr = new EmailManager();
            EmailContents mailContents = new EmailContents();

            mailContents.To = Request.QueryString[ "Email" ];
            mailContents.Subject = "Live Free Range Update - Order ID: " + Request.QueryString["OrderId"];
            mailContents.Body = "Your order has been updated.  Please log into your account for details.";
            mailContents.FromEmailAddress = "*****@*****.**";
            emailMngr.Send( mailContents );

            if ( !emailMngr.IsSent )
            {
                Response.Redirect("../ErrorPage.aspx");
            }
        }
        catch(Exception ex)
        {
            Response.Redirect( "../ErrorPage.aspx" );
        }

        Response.Redirect( "Orders.aspx" );
    }