how to create dynamic html email

T

thsman

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?
 
M

Mike Brind [MVP]

thsman said:
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.
 
A

Anthony Jones

thsman said:
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.
 
A

Anthony Jones

Mike Brind said:
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.
 
T

thsman

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
 
D

Dooza

thsman said:
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
 
M

Mike Brind

Anthony Jones said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top