By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,854 Members | 1,909 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,854 IT Pros & Developers. It's quick & easy.

Need help sending CDO email with dynamic HTML attachment

P: n/a
Hi.

I'm using CDO SYS to send email messages. I can attach a file just fine.
However, I need to attach an HTML page that's generated on the fly by my
ASP code. The attachment source code gets assembled into a VB string. How
do I attach this? I think there was an easy way in CDONTS but that's no
longer an option.

Thanks in advance.
-Geoff
Jul 22 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
"NetNoise" wrote ...
I'm using CDO SYS to send email messages. I can attach a file just fine.
However, I need to attach an HTML page that's generated on the fly by my
ASP code. The attachment source code gets assembled into a VB string. How
do I attach this? I think there was an easy way in CDONTS but that's no
longer an option.


Hi,

Why not write your string out to the server and save the html file, then
attach it.

You'd need to give each file a unique number, and obviously remove them
again to tidy up (assuming now history/audit is required).

Regards

Rob
Jul 22 '05 #2

P: n/a
io
G'day Geoff,

The following should work:

..........................
..........................
..........................
Dim Mail

Set Mail=Server.CreateObject("CDONTS.NewMail")
Mail.To = <ToAddress>
Mail.From = <FromAddress>
Mail.Subject = <Your Subject>
Mail.BodyFormat = 0 'This indicates HTML
Mail.Body = <Your HTML>
Mail.Send

..........................
..........................
..........................

Cheers

"NetNoise" <me@privacy.net> wrote in message
news:Xn********************************@130.133.1. 4...
Hi.

I'm using CDO SYS to send email messages. I can attach a file just fine.
However, I need to attach an HTML page that's generated on the fly by my
ASP code. The attachment source code gets assembled into a VB string. How
do I attach this? I think there was an easy way in CDONTS but that's no
longer an option.

Thanks in advance.
-Geoff

Jul 22 '05 #3

P: n/a
"Rob Meade" <ro********@NO-SPAM.kingswoodweb.net> wrote in
news:jj****************@text.news.blueyonder.co.uk :
"NetNoise" wrote ...
I'm using CDO SYS to send email messages. I can attach a file just
fine. However, I need to attach an HTML page that's generated on the
fly by my ASP code. The attachment source code gets assembled into a
VB string. How do I attach this? I think there was an easy way in
CDONTS but that's no longer an option.


Hi,

Why not write your string out to the server and save the html file,
then attach it.

You'd need to give each file a unique number, and obviously remove
them again to tidy up (assuming now history/audit is required).

Regards

Rob


Thanks Rob. I had thought about that solution. I was hoping not to need
that level of complexity but it may be the only way.
Jul 22 '05 #4

P: n/a
Thanks for the quick reply... but:
1. CDONTS is not an option (they upgraded to Win2003 Server), and
2. I need the HTML to show up as a file attachment

I'm using the CDO-SYS equivalient of your suggestion right now and it
works just fine.

Cheers.
-Geoff
"io" <io********@agrilink-int.com> wrote in
news:Oo**************@TK2MSFTNGP14.phx.gbl:
G'day Geoff,

The following should work:

.........................
.........................
.........................
Dim Mail

Set Mail=Server.CreateObject("CDONTS.NewMail")
Mail.To = <ToAddress>
Mail.From = <FromAddress>
Mail.Subject = <Your Subject>
Mail.BodyFormat = 0 'This indicates HTML
Mail.Body = <Your HTML>
Mail.Send

.........................
.........................
.........................

Cheers

"NetNoise" <me@privacy.net> wrote in message
news:Xn********************************@130.133.1. 4...
Hi.

I'm using CDO SYS to send email messages. I can attach a file just
fine. However, I need to attach an HTML page that's generated on the
fly by my ASP code. The attachment source code gets assembled into a
VB string. How do I attach this? I think there was an easy way in
CDONTS but that's no longer an option.

Thanks in advance.
-Geoff

Jul 22 '05 #5

P: n/a

"NetNoise" <me@privacy.net> wrote in message
news:Xn*********************************@130.133.1 .4...
"Rob Meade" <ro********@NO-SPAM.kingswoodweb.net> wrote in
news:jj****************@text.news.blueyonder.co.uk :
"NetNoise" wrote ...
I'm using CDO SYS to send email messages. I can attach a file just
fine. However, I need to attach an HTML page that's generated on the
fly by my ASP code. The attachment source code gets assembled into a
VB string. How do I attach this? I think there was an easy way in
CDONTS but that's no longer an option.


Hi,

Why not write your string out to the server and save the html file,
then attach it.

You'd need to give each file a unique number, and obviously remove
them again to tidy up (assuming now history/audit is required).

Regards

Rob


Thanks Rob. I had thought about that solution. I was hoping not to need
that level of complexity but it may be the only way.


You can avoid the need to create a temporary file by writing directly to the
IStream interface that is implemented by the IBodyPart interface. Here's the
documentation for the AddBodyPart Method of the IBodyPart interface which
has an example of what you're attempting to do:
http://www.msdn.microsoft.com/librar...ddbodypart.asp

HTH
-Chris Hohmann
Jul 22 '05 #6

P: n/a
"Chris Hohmann" <no****@thankyou.com> wrote in
news:eA**************@tk2msftngp13.phx.gbl:

"NetNoise" <me@privacy.net> wrote in message
news:Xn*********************************@130.133.1 .4...
"Rob Meade" <ro********@NO-SPAM.kingswoodweb.net> wrote in
news:jj****************@text.news.blueyonder.co.uk :
> "NetNoise" wrote ...
>
>> I'm using CDO SYS to send email messages. I can attach a file just
>> fine. However, I need to attach an HTML page that's generated on
>> the fly by my ASP code. The attachment source code gets assembled
>> into a VB string. How do I attach this? I think there was an easy
>> way in CDONTS but that's no longer an option.
>
> Hi,
>
> Why not write your string out to the server and save the html file,
> then attach it.
>
> You'd need to give each file a unique number, and obviously remove
> them again to tidy up (assuming now history/audit is required).
>
> Regards
>
> Rob


Thanks Rob. I had thought about that solution. I was hoping not to
need that level of complexity but it may be the only way.


You can avoid the need to create a temporary file by writing directly
to the IStream interface that is implemented by the IBodyPart
interface. Here's the documentation for the AddBodyPart Method of the
IBodyPart interface which has an example of what you're attempting to
do:
http://www.msdn.microsoft.com/librar...cdosys_ibodypa
rt_addbodypart.asp

HTH
-Chris Hohmann

That looks like exactly what I need. Thank you!
-Geoff
Jul 22 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.