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

Html emails

Hi

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

objOutlook = CreateObject("Outlook.Application")
objOutlookMsg = objOutlook.CreateItem(Outlook.OlItemType.olMailIte m)
fso = CreateObject("Scripting.FileSystemObject")
ts = fso.OpenTextFile(m_objParentForm.txtHtml.Text.ToSt ring, 1)
eMessage = ts.ReadAll
With objOutlookMsg
eto = "Re*******@mydomian.com"
objOutlookRecip = .Recipients.Add(eto)
objOutlookRecip.Type = Outlook.OlMailRecipientType.olTo
.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 2289
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("Scripting.FileSystemObject")
ts = fso.OpenTextFile(m_objParentForm.txtHtml.Text.ToSt ring, 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>Please 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****************@TK2MSFTNGP11.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>Please 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("Scripting.FileSystemObject")
ts = fso.OpenTextFile(m_objParentForm.txtHtml.Text.ToSt ring, 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("Outlook.Application")
objOutlookMsg = objOutlook.CreateItem(Outlook.OlItemType.olMailIte m)
fso = CreateObject("Scripting.FileSystemObject")
ts = fso.OpenTextFile(m_objParentForm.txtHtml.Text.ToSt ring, 1)
eMessage = ts.ReadAll
With objOutlookMsg
eto = "Re*******@mydomian.com"
objOutlookRecip = .Recipients.Add(eto)
objOutlookRecip.Type = Outlook.OlMailRecipientType.olTo
.Subject = "My Subject"
.HTMLBody = eMessage
.Send()
End With
objOutlook = Nothing

Thanks

Regards

"Fergus Cooney" <fi******@tesco.net> wrote in message
news:ut**************@TK2MSFTNGP10.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
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...
7
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....
5
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...
7
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...
12
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...
21
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...
1
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...
2
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...
1
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 =...
0
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...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.