Veep
I really like the coding you have above, and I tried and it work. I would like to ask you something,
I have a message body of about 10 lines. Do I have to put all of them on the top like you did for testing one .. two...three?
and how do I do that?
thanks
I'm not really sure what you're asking. You could replace the html with a text body like this:
With objMail
.To = "them@abc.com"
.CC = "him@def.com"
.From = "you@ghi.com"
.Subject = "CDO Mail Test"
.TextBody="Hello There" & vbcrlf & "How is the weather today?" _
& vbcrlf & "Got to go now"
.Send
End With
I have a very similar requirement - I need VBScript to create a new email (with some formatted body text already in place) and present it on screen as a new Outlook message - ready for further editing.
Here is a script I generate in a cobol program.
The script body is client variable and it attaches an excel
Spread sheet. The script runs outlook via MAPI.
Enjoy Bob
Dim ToAddress
Dim FromAddress
Dim MessageSubject
Dim Body1
Dim MessageAttachment
Dim ol, ns, newMail
Dim Body2
Dim Body3
Dim Body4
Dim Body5
Dim Body6
Dim Body7
Dim Body8
Dim Body9
Dim Body10
ToAddress = "admin@somewhere.com"
MessageSubject = "Magazine Sales Leads For you"
BODY1 = "TO: ME "
BODY2 = "COMAPNY NAME "
BODY3 = "11114 MAIN ST "
BODY4 = "GULFPORT, MS 39503 "
BODY5 = "From: MY Magazine Phone: 999-555-5601"
BODY6 = "24 MAIN STREET fax: 999-555-5640"
BODY7 = "Suite 99"
BODY8 = "Lambert, NJ 08530"
BODY10 = "This file can be opened with Microsoft Excel"
MessageBody = "Here are your leads for 06-16-2004"
MessageAttachment = "Y:\FOLDER\FOLDER\00110.XLS"
Set ol = WScript.CreateObject("Outlook.Application")
Set ns = ol.getNamespace("MAPI")
Set newMail = ol.CreateItem(olMailItem)
newMail.Subject = MessageSubject
newMail.Body = BodY1 & vbCrLf & BODY2 & VBCRLF & BODY3 & VBCRLF & BODY4 & VBCRLF & vbcrlf & BODY5 & VBCRLF & BODY6 & vbcrlf & body7 & vbcrlf & body8 & vbcrlf & vbcrlf & Messagebody & vbcrlf & body10 & vbcrlf & vbcrlf
newMail.RecipIents.Add(ToAddress)
newMail.Attachments.Add(MessageAttachment)
newMail.Send
SET OL = NOTHING
SET NS = NOTHING
SET NEWMAIL = NOTHING
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.