how to create dynamic html email

Discussion in 'ASP General' started by thsman, Oct 1, 2008.

  1. thsman

    thsman Guest

    I have a shopping cart that can have anything from one to hundreds of
    different items ordered. I can generate an asp page to show the order
    to the customer but I then want to send a similarly formatted email to
    the site owner. How can I put this dynamic order table into an email
    message body?
    thsman, Oct 1, 2008
    #1
    1. Advertising

  2. "thsman" <> wrote in message
    news:...
    >I have a shopping cart that can have anything from one to hundreds of
    > different items ordered. I can generate an asp page to show the order
    > to the customer but I then want to send a similarly formatted email to
    > the site owner. How can I put this dynamic order table into an email
    > message body?


    In exactly the same way as you would put it in a page. It's fundamentally
    just a string of text.

    --
    Mike Brind
    MVP - ASP/ASP.NET
    Mike Brind [MVP], Oct 1, 2008
    #2
    1. Advertising

  3. "thsman" <> wrote in message
    news:...
    >I have a shopping cart that can have anything from one to hundreds of
    > different items ordered. I can generate an asp page to show the order
    > to the customer but I then want to send a similarly formatted email to
    > the site owner. How can I put this dynamic order table into an email
    > message body?


    This is a quick an dirty way to do it:-

    http://msdn.microsoft.com/en-gb/library/ms527024(EXCHG.10).aspx

    You could use the existing web page as a source for the HTML body of the
    message. However it has not a few drawbacks. Some of which can be
    mitigated if you create a new version of your order confirmation page that
    has simplified content, limit graphics, no javascript etc for the express
    purpose of being used for email.

    You should do this using a VBScript file run as a scheduled task it should
    be able to access any order without recourse to session variables. Use
    integrated security or IP restrictions to ensure external clients can't
    access content they are not entitled to see.

    N.B. the method above is not recommend for use within ASP itself.

    --
    Anthony Jones - MVP ASP/ASP.NET
    Anthony Jones, Oct 1, 2008
    #3
  4. "Mike Brind [MVP]" <> wrote in message
    news:...
    >
    > "thsman" <> wrote in message
    > news:...
    >>I have a shopping cart that can have anything from one to hundreds of
    >> different items ordered. I can generate an asp page to show the order
    >> to the customer but I then want to send a similarly formatted email to
    >> the site owner. How can I put this dynamic order table into an email
    >> message body?

    >
    > In exactly the same way as you would put it in a page. It's fundamentally
    > just a string of text.
    >


    Its hardly 'exactly' the same. To build up a string you do not have the
    benefit of inline static content or even response.write. In other words you
    need to create the output buffer yourself.

    I believe this can dealt to some degree by accessing the HTML body part's
    decoded stream, that would give a similar object.write experience that you
    get when generating output in ASP although everything would have to be done
    via the write method.

    I keep meaning to set a sample up for this but never get the time.

    --
    Anthony Jones - MVP ASP/ASP.NET
    Anthony Jones, Oct 1, 2008
    #4
  5. thsman

    thsman Guest

    It was a nightmare of quotation marks but eventually worked out to be
    just a string. I would not like to do this every day.

    Bernie
    thsman, Oct 1, 2008
    #5
  6. thsman

    Dooza Guest

    thsman wrote:
    > I have a shopping cart that can have anything from one to hundreds of
    > different items ordered. I can generate an asp page to show the order
    > to the customer but I then want to send a similarly formatted email to
    > the site owner. How can I put this dynamic order table into an email
    > message body?


    This is where I would use Dreamweaver and an extension called Universal
    Email from www.webassist.com. It allows you to copy and paste your asp
    code into the body and it will create the response.writes for you, for
    your chosen mail provider, like CDOSYS or any other that it supports. It
    has saved me many hours over the years.

    I know many of you frown upon Dreamweaver, but when it can save you
    hours of work it can be worth it.

    Steve
    Dooza, Oct 2, 2008
    #6
  7. thsman

    Mike Brind Guest

    "Anthony Jones" <> wrote in message
    news:...
    > "Mike Brind [MVP]" <> wrote in message
    > news:...
    >>
    >> "thsman" <> wrote in message
    >> news:...
    >>>I have a shopping cart that can have anything from one to hundreds of
    >>> different items ordered. I can generate an asp page to show the order
    >>> to the customer but I then want to send a similarly formatted email to
    >>> the site owner. How can I put this dynamic order table into an email
    >>> message body?

    >>
    >> In exactly the same way as you would put it in a page. It's
    >> fundamentally just a string of text.
    >>

    >
    > Its hardly 'exactly' the same. To build up a string you do not have the
    > benefit of inline static content or even response.write. In other words
    > you need to create the output buffer yourself.
    >


    Thanks for the clarification, Anthony. I should have been more specific:
    it's just a string. You would create it in exactly the same way as if you
    were outputting it to the page.

    --
    Mike Brind
    MVP - ASP/ASP.NET
    Mike Brind, Oct 4, 2008
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tirrell payton

    how to create a dynamic email from variable

    tirrell payton, Jan 20, 2007, in forum: ASP .Net
    Replies:
    7
    Views:
    376
    Nitin
    Jan 23, 2007
  2. jason
    Replies:
    2
    Views:
    110
    jason
    Oct 9, 2003
  3. NetNoise
    Replies:
    6
    Views:
    356
    NetNoise
    Jan 10, 2005
  4. Sending dynamic html email

    , Oct 9, 2005, in forum: ASP General
    Replies:
    0
    Views:
    86
  5. Sending dynamic html email

    , Oct 9, 2005, in forum: ASP General
    Replies:
    2
    Views:
    96
Loading...

Share This Page