473,327 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Need help sending CDO email with dynamic HTML attachment

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
6 4657
"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
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
"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
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

"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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paul Lamonby | last post by:
Hi, I am sending a file from the server as an email attachment. The file is being attached no problem and sending the email, but I get an error when I try to open it saying it is corrupt....
0
by: Dragos Marian Barbu | last post by:
Recently I tried to develop a function to help me sending e-mail messages with more than one attachment. Everything is working OK when I am sebding messages with one attachment, but when I try to...
4
by: VB Programmer | last post by:
I have an HTML newsletter that I want to email to a bunch of people found in a database. 1. I want some parts of the newsletter to filled in dynamically from a database (company, address,...
6
by: Anuradha | last post by:
Dear All How can i send mails using vb.net Thanx all
7
by: Ray Booysen | last post by:
Hi all I'm sending email via ASP.NET in HTML mode. Each email has exactly one attachment and I do have full access to the SMTP server. However, if I send the email in HTML format, the...
33
by: STILL LEARNING | last post by:
I'm not sure if this can even be done, but what prompts the question is my desire to be able to create an "Uber Link" script/code of some sort, such that even if the html page contains nothing but...
2
by: prasenjit2007 | last post by:
Hello, can u help me sending Email with attachments using the Class phpMailer. On the website I have a link to an html form in which I input the parameters with the names 1)from(textbox name)...
7
by: Paridevi | last post by:
Hai , i want to send email in .Net Using OutLook Express,My Project is Web Application using vb.Net 2003 with SQL Server 2000.I have searched a lot in Google, but ican't get any...
3
by: raj200809 | last post by:
when i m sending mail i received error from symantec Antivirus" Your email message was unable to be sent because your mail server rejected the message 550-5.7.1 the ip you’re using to send mail is...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.