473,396 Members | 1,860 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,396 software developers and data experts.

Embedding images and dynamic content in an email, programmatically

In my code to send email from VBScript, I use standard CDOSYS code similar to
the following:

With oMsg
Set .Configuration = oCon
.To = """Admin"" <ad***@mycompany.com>"
.From = """Joe Admin"" <jad***@mycompany.com>"
.Subject = "Hey You!"
.TextBody = "Service(s) have failed!"
.Send
End With

I understand the use of the .HTMLBody property, as well as the
..CreateMHTMLBody method. So I know I can create an ASP or HTML page, and
pass it to the .CreateMHTMLBody method, to get the images truly embedded, so
the email source contains the cid:blahblahblah references to the images,
which is key to getting the email to display properly in web-based mail
clients.

My question is... how do I achieve the same thing (embed the images) that
the .CreateMHTMLBody method does automatically, manually, so I can also
inject values passed from a form postback into the email?

It seems that I shouldn't use the .CreateMHTMLBody method. It seems that I
need to manually accomplish what it accomplishes automatically, so I have
more granular control. But I have found no thorough online resources that
explain exactly how. I have thoroughly looked at all of the SDK information
pertaining to CDOSYS, and I am still in dire need of an example for
VBScript...

It seems that the .AddRelatedBodyPart method is part of the answer, but when
I use it to embed the images and fill .HTMLBody, rather than using the
..CreateMHTMLBody method, I do not see cid:blahblahblah in the email source,
and the images do not display properly in web-based mail clients such as
Outlook Web Access.

I really need some help on this. It would also appear that I am not alone.
I find plenty of questions on this, but no answers. Can anyone help with a
working VBScript example that embeds images into an email in a fashion that
yields the cid:blahblahblah in the email source, for the image references,
that does not use the .CreateMHTMLBody method to do the work automatically?

Jul 19 '05 #1
1 4431
The answer is to use .addRelatedBodyParts, the example that they provide is
missing something, the place where "..src=""xyz.gif"" is mentioned, you
should modify the HTML to say "...src=""cid:xyz.gif"", and reference
"xyz.gif" when you call addRelatedBodyParts. I was working on these for days,
and by just mere luck, I stumble onto it...hope this helps.

Alex

"Chris Nafziger" wrote:
In my code to send email from VBScript, I use standard CDOSYS code similar to
the following:

With oMsg
Set .Configuration = oCon
.To = """Admin"" <ad***@mycompany.com>"
.From = """Joe Admin"" <jad***@mycompany.com>"
.Subject = "Hey You!"
.TextBody = "Service(s) have failed!"
.Send
End With

I understand the use of the .HTMLBody property, as well as the
.CreateMHTMLBody method. So I know I can create an ASP or HTML page, and
pass it to the .CreateMHTMLBody method, to get the images truly embedded, so
the email source contains the cid:blahblahblah references to the images,
which is key to getting the email to display properly in web-based mail
clients.

My question is... how do I achieve the same thing (embed the images) that
the .CreateMHTMLBody method does automatically, manually, so I can also
inject values passed from a form postback into the email?

It seems that I shouldn't use the .CreateMHTMLBody method. It seems that I
need to manually accomplish what it accomplishes automatically, so I have
more granular control. But I have found no thorough online resources that
explain exactly how. I have thoroughly looked at all of the SDK information
pertaining to CDOSYS, and I am still in dire need of an example for
VBScript...

It seems that the .AddRelatedBodyPart method is part of the answer, but when
I use it to embed the images and fill .HTMLBody, rather than using the
.CreateMHTMLBody method, I do not see cid:blahblahblah in the email source,
and the images do not display properly in web-based mail clients such as
Outlook Web Access.

I really need some help on this. It would also appear that I am not alone.
I find plenty of questions on this, but no answers. Can anyone help with a
working VBScript example that embeds images into an email in a fashion that
yields the cid:blahblahblah in the email source, for the image references,
that does not use the .CreateMHTMLBody method to do the work automatically?

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: K | last post by:
I have found a script online that I want to use (I am new to PHP). It creates dynamic images based on the text that you pass it. However, no matter how I try, I can't get anything other than a...
2
by: Dean J. Garrett | last post by:
Hi, I need to create HTML e-mail from an ASP program that includes embedded images that go along with the e-mail, e.g. logos, product image, etc. Is there a technique in HTML that people use to...
7
by: Ken Fine | last post by:
My well-heeled clients would like a tool that I could build into a web application that would suck down the entire contents a remote webpage and store it on a local filesystem. I know how to...
2
by: dr_tyson | last post by:
I am trying to embed images into a wxPython app (created using Boa Constructor), but have not been able to do so. I know how to embed plots, but images seem to be a problem. I've tried using code...
3
by: Tim T | last post by:
Hi, I hope there is someone reading this that has the answer, Please Help! I have the need to send a html email via asp.net. its easy enough to send an html email and add attachments. My...
61
by: phil-news-nospam | last post by:
Why does SVG need a different tag than other images? IMHO, SVG should be implemented as an image type just like any other image type, allowing it to work with <img> tags, and ... here is the...
1
by: MissMarie | last post by:
I've been playing around with DIV tables in myspace to better learn how to rewrite my own code for my business site without having to pay someone to design it. I've tried embedding a slideshow into...
1
by: neovantage | last post by:
Hey all, I am using a PHP script which creates headings at run time in a sense at page execution. I am stuck a with a very little problem which i am sure i will have the solution from experts. ...
5
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.