473,770 Members | 3,983 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4688
"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.Cre ateObject("CDON TS.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.1 33.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********@N O-SPAM.kingswoodw eb.net> wrote in
news:jj******** ********@text.n ews.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********@agr ilink-int.com> wrote in
news:Oo******** ******@TK2MSFTN GP14.phx.gbl:
G'day Geoff,

The following should work:

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

Set Mail=Server.Cre ateObject("CDON TS.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.1 33.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********@N O-SPAM.kingswoodw eb.net> wrote in
news:jj******** ********@text.n ews.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****@thankyo u.com> wrote in
news:eA******** ******@tk2msftn gp13.phx.gbl:

"NetNoise" <me@privacy.net > wrote in message
news:Xn******** *************** **********@130. 133.1.4...
"Rob Meade" <ro********@N O-SPAM.kingswoodw eb.net> wrote in
news:jj******** ********@text.n ews.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
7052
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. Obviuosly, the file is fine on the server, so the attachment code I am using must be corrupting it, but I dont know what it is: // send email with attachment function emailAttachment($to, $subject, $message, $name, $email,
0
1488
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 send more than one file as attachment I get the following error: -------- Error ----------------- Could not access 'CDO.Message' object. at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object args) at...
4
1338
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, etc...) 2. I want to email send the HTML newletter in the BODY of the message (ie NOT an attachment.) Using ASP.NET and VB.NET, what is the best way to do this?
6
2750
by: Anuradha | last post by:
Dear All How can i send mails using vb.net Thanx all
7
4388
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 framework reports the following exception: "System.Web.HttpException: Could not access 'CDO.Message' object. ---> System.Reflection.TargetInvocationException: Exception has been thrown
33
2394
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 a background image -or- a background color -- in other words, the page has neither content nor placed images -- any click, ANYWHERE, will launch the URL in your browser. I realize I can make traditional text links and graphics links; what I'm...
2
4558
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) 2)To 3) Subject 4) Message5) File input(name abc) - to be sent as an attachment. This form calls the Class PhpMailer through another form with the following code to send the mail. <?php ini_set("include_path",...
7
8560
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 details. Pls its urgent for me. Can any one give me any idea about this. Thanks in advance Pari
3
2395
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 not authorized" i have configure smtp server put 127.0.0.1 ip in relay and also put 127.0.0.1 ip in connection. using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing;
0
9591
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10228
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10057
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10002
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7415
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5312
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.