473,748 Members | 4,951 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Html emails

Hi

I am using the following code to send html emails via outlook.

objOutlook = CreateObject("O utlook.Applicat ion")
objOutlookMsg = objOutlook.Crea teItem(Outlook. OlItemType.olMa ilItem)
fso = CreateObject("S cripting.FileSy stemObject")
ts = fso.OpenTextFil e(m_objParentFo rm.txtHtml.Text .ToString, 1)
eMessage = ts.ReadAll
With objOutlookMsg
eto = "Re*******@mydo mian.com"
objOutlookRecip = .Recipients.Add (eto)
objOutlookRecip .Type = Outlook.OlMailR ecipientType.ol To
.Subject = "My Subject"
.HTMLBody = eMessage
.Send()
End With
objOutlook = Nothing

The problem is that bodies of emails are coming out blank, where there
should be html read from file. What am I doing wrong?

Thanks

Regards
Nov 20 '05 #1
8 2304
Cor
Hi John,
This is not VB.net code, it is VB scripting.
Information about this, you can ask better in a scripting newsgroup.
As far as I can see is the problem in this part of the code
fso = CreateObject("S cripting.FileSy stemObject")
ts = fso.OpenTextFil e(m_objParentFo rm.txtHtml.Text .ToString, 1)

I thought that with this code alone, you don't read the file.

I hope this helps a bit.
Cor
Nov 20 '05 #2
Hi John,

Some questions.

Have you verified that you are opening your file correctly?
Have you verified that you are reading your file successfully?
Does the file contain valid HTML?
If you assign a string of HTML, eg "<html><body>Pl ease work for
me!!</body></html>", to the HTMLBody, does it accept it?

Regards,
Fergus
Nov 20 '05 #3
Yes to all the questions. I placed a breakpoint and emessage value shows at
each step when I bring the mouse over it. The file is read correctly into
emessage, which is the most puzzling thing.

Thanks

Regards
"Fergus Cooney" <fi******@tesco .net> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Hi John,

Some questions.

Have you verified that you are opening your file correctly?
Have you verified that you are reading your file successfully?
Does the file contain valid HTML?
If you assign a string of HTML, eg "<html><body>Pl ease work for
me!!</body></html>", to the HTMLBody, does it accept it?

Regards,
Fergus

Nov 20 '05 #4
Hi

It seems to compile OK in vb.net. I am not too comfortable with substring so
I still use left/right etc. Is there an example of html mailing from vb.net,
using outlook, somewhere?

Thanks

Regards

"Cor" <no*@non.com> wrote in message
news:3f******** **************@ reader21.wxs.nl ...
Hi John,
This is not VB.net code, it is VB scripting.
Information about this, you can ask better in a scripting newsgroup.
As far as I can see is the problem in this part of the code
fso = CreateObject("S cripting.FileSy stemObject")
ts = fso.OpenTextFil e(m_objParentFo rm.txtHtml.Text .ToString, 1)

I thought that with this code alone, you don't read the file.

I hope this helps a bit.
Cor

Nov 20 '05 #5
Hi John,

If you post your actual code, ie something that I can run immediately,
then I can try it out.

Regards,
Fergus
Nov 20 '05 #6

Here it is;

objOutlook = CreateObject("O utlook.Applicat ion")
objOutlookMsg = objOutlook.Crea teItem(Outlook. OlItemType.olMa ilItem)
fso = CreateObject("S cripting.FileSy stemObject")
ts = fso.OpenTextFil e(m_objParentFo rm.txtHtml.Text .ToString, 1)
eMessage = ts.ReadAll
With objOutlookMsg
eto = "Re*******@mydo mian.com"
objOutlookRecip = .Recipients.Add (eto)
objOutlookRecip .Type = Outlook.OlMailR ecipientType.ol To
.Subject = "My Subject"
.HTMLBody = eMessage
.Send()
End With
objOutlook = Nothing

Thanks

Regards

"Fergus Cooney" <fi******@tesco .net> wrote in message
news:ut******** ******@TK2MSFTN GP10.phx.gbl...
Hi John,

If you post your actual code, ie something that I can run immediately,
then I can try it out.

Regards,
Fergus

Nov 20 '05 #7
Hi John,

Lol. That's the same code as in your original post!!

I tried it when you first posted it. Unfortunately it doesn't compile. At
the least I would like a complete Sub/Function with all variables declared,
etc. Then I'd have to build a test harness around it.

What I was asking and hoping for is something that I can <run
immediately>. A zip of a working project (complete with the correct
references) that I can simply open and run.

Want to give it another shot?

Regards,
Fergus
Nov 20 '05 #8
Cor
Hi John,
In addition to Fergus,
This is the part in Fergus message I am also specialy curious for
all variables declared,

Cor

Nov 20 '05 #9

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

Similar topics

1
2893
by: dan glenn | last post by:
I'm creating HTML emails from a PHP site and sending them out to an email list (just about 40 people so far are on this list). I've tested and confirmed that these emails work in yahoo.com's webmail. And I know they work on *my* Outlook Express. But I have one person (I know of) who gets the emails as plain text, so she sees the HTML code for the email instead of its proper representation. She has, like myself, OE6, and other html emails...
7
2213
by: news | last post by:
Before I begin, I realise there's a big war regarding HTML in e-mails. Personally, I don't like it. Unfortunately, I'm being paid by my company to create an automated newsletter for our customers. I did all I could just to get them to allow me to have it sent in both plaintext and HTML so that the e-mail clients have a choice. Anyway. I've looked around the RFC's and the source of similar e-mails, and I'm certain I figured out how to do...
5
2636
by: BaWork | last post by:
I have a web form where a client can select which site members to send an email to. This form is populated from the contents of the member table, so the form can have 0-x names listed on it depending on member expiration dates. When the form is submitted, the code loops through the form contents and sends an email to those members that meet the selected criteria. All this worked perfectly when I was sending text emails, but since I
7
1750
by: Tappy Tibbons | last post by:
We are writing a dotnet app that among other things retrieves messages from a standard POP3 mailbox, and then performs certain actions with that email automatically. Some of the emails are coming in as HTML, which makes the email itself 8 times as large when it comes time to store it, as well as makes it impossible to display to the user using any sort of standard dotnet control. Is there a way to STRIP OUT all the html tags and get...
12
3938
by: Dave G | last post by:
Apologies if this has been covered before - I couldn't find it. I currently use ASPEmail to create and send HTML emails from an Access database. The text is personalised and includes embedded graphics, eg logos and even the recipients photo. Note that everything is embedded, no attachments are sent. ASPEmail works a treat but is very long winded to create. The email designs come to me as finished HTML but I have to extract the source and...
21
2733
by: maya | last post by:
hi, I'm designing an HTML email for a client.. I know general guidelines (no CSS, no JavaScript... although I do use limited CSS, inside tags (as in <span style=".."we do this at work and it works fine, so I figured it's ok..) but I have a few more questions, for example, is it ok to do client-side image-maps? is there a web page somewhere with general guidelines for HTML e-mails? (and what is best way to test HTML e-mails? (I...
1
2945
by: robbiesmith79 | last post by:
Just so this is out there on the web, I battled the past 24 hours about this. Background info... I developed a ecommerce website in PHP 4 on a shared linux hosting plan from GoDaddy and had the html formatted emails sending as text/html and were going fine with limited header information. Then we moved the site over to a Dedicated Linux hosting plan. This time, it's PHP 5. Things are bound to not work as expected moving to a new...
2
1712
by: Big Moxy | last post by:
Here is my code for formatting an HTML email. I know that spinning through the $_POST array as I am isn't very pretty but it's a long list so for now I'm using this approach. The problem is that despite setting the Content-type the resulting email arrives in plain text. Outlook 2003 is my email client and I receive HTML emails without a problem. Can someone please advise me on what I'm doing wrong? $to_address = "to@mysite.com";
1
2541
by: Lelu | last post by:
Hi, My HTML form is generating some blank email responses; does anyone see anything wrong with the scripts?: function isFormVarExcluded(thisForm, strToCheck) { var strExcludeVars = thisForm.elements.value; var arrExcludeVars = strExcludeVars.split(","); for (var j=0; j<arrExcludeVars.length; j++) { if (arrExcludeVars == strToCheck) return true;
0
3212
by: kronus | last post by:
Hey everyone, I am stumped once more and you guys have always helped in one way or the other. I am just now starting to fool around with using PEAR to send html emails. Following the sample scripts -- http://www.phpmaniac.net/wiki/index.php/Pear_Mail#Sending_to_multiple_recipients -- I was able to send html emails with no problem. However, when I applied these concepts to a dynamically generated email, the recipients would receive an...
0
8989
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
9537
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
9243
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6073
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
4599
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
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3309
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2213
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.