Click here to Skip to main content
12,633,990 members (24,375 online)

Shopping Cart List View Email

Member 9608236 asked:

Open original thread
Hi All,

im having an issue trying to get the items in the shopping cart which is displayed using a listbox to also be displayed in the email which gets sent after the order is processed, one to admin and a receipt to the customer.

    Protected Sub btnProOrd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnProOrd.Click
        Dim sName As String, sEmail As String, sAddress As String, sSub As String
        Dim sPCode As String, sState As String, sOrder As String, sPayment As String


        sName = Trim(CusName.Text)
        sEmail = Trim(CusEmail.Text)
        sAddress = Trim(CusAddr.Text)
        sSub = Trim(CusSub.Text)
        sPCode = Trim(CusPCode.Text)
        sState = Trim(CusState.Text)
        sPayment = Trim(lstCardType.Text)
        sOrder = Trim(lstCart.Items.ToString)



        Dim MyMail As New MailMessage()
        MyMail.From = New MailAddress(CusEmail.Text)
        MyMail.To.Add(txtTo.Text)
        MyMail.To.Add(CusEmail.Text)

        MyMail.Body = "New Order Recieved" + vbNewLine + "Customer Name" + " " + sName + vbNewLine + "Customer Address" + vbNewLine + sAddress + vbNewLine + sSub + " " + sPCode + " " + sState + vbNewLine + vbNewLine + "Payment Method" + " " + sPayment + vbNewLine + "Customer Order" + vbNewLine + sOrder


        Dim SmtpMail As New SmtpClient
        SmtpMail.Send(MyMail)

        MsgBox("Your order has been submitted for processing. A copy has been sent to your email as well.")


Any help is appreciated.
Thanks
Tags: VB, VB.NET, eCommerce, email

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).



Advertise | Privacy | Mobile
Web01 | 2.8.161208.2 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100