![]() |
Outlook 2003 Script: HTML Mail
Hi all,
I made a custom task wich generate and send an e-mail (HTML), I used HTML.body I have 3 pb 1) How to add variable (some text) to the HTML body ? when I add something all the content of the Html is replaced by the text I added and the body switch to Text format.... 2) I added an image (logo) to the HTML mail but when the mail is received the place of the image is empty 3) I want to use different color in my Html mail but I fail to use more than one color , it always take the last color I used Tks fo help |
Outlook 2003 Script: HTML Mail
1) Show a code snippet to illustrate the problem. Remember that the content of HTMLBody must be fully tagged, consistent HTML code, just like in a web page.
2) See http://www.outlookcode.com/d/code/htmlimg.htm 3) Use font tags, just as you would in a web page. -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "news.microsoft.com" wrote in message ... Hi all, I made a custom task wich generate and send an e-mail (HTML), I used HTML.body I have 3 pb 1) How to add variable (some text) to the HTML body ? when I add something all the content of the Html is replaced by the text I added and the body switch to Text format.... 2) I added an image (logo) to the HTML mail but when the mail is received the place of the image is empty 3) I want to use different color in my Html mail but I fail to use more than one color , it always take the last color I used Tks fo help |
Outlook 2003 Script: HTML Mail
Hi Sue,
3) solved it'was easy tks sue 2) I'll take a look 1)here a part of the code sub SendAlertButton_click() ' THIS IS THE CONTENT OF THE BODY OF MY ' TASK THAT I WANT TO ADD TO THE CONTENT OF HTML MALI StrBB = item.body Set myItem = Application.CreateItem(0) StrHTML = "HTMLbiH1This is the Header of my mail/H1/i/bbrbrhrp align=""center"" img src=""\\MyComputer\myfolder\Images\MyImage.bmp"" /PhrbrbrbrpH2 style=""color:red""This some infomation about the content/H2bra /a/p brPscript type=text/vbscriptdocument.write(item.body)/script/P/HTML" 'HERE ARE THE DIFFERENT THINGS I TRYED StrHTML = StrHTML & "p" & strDetails & "/p" myitem.HTMLBody = StrHTML 'myitem.Body = StrHTML + StrBB myitem.htmlBody = myitem.htmlbody & "HTMLMMMMMMMMMMMMMMMMMMM/HTML" myitem.Display myitem.HTMLBody = StrHTML + StrBB End Sub ================================================== =============== "Sue Mosher [MVP-Outlook]" a écrit dans le message de news: ... 1) Show a code snippet to illustrate the problem. Remember that the content of HTMLBody must be fully tagged, consistent HTML code, just like in a web page. 2) See http://www.outlookcode.com/d/code/htmlimg.htm 3) Use font tags, just as you would in a web page. -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "news.microsoft.com" wrote in message ... Hi all, I made a custom task wich generate and send an e-mail (HTML), I used HTML.body I have 3 pb 1) How to add variable (some text) to the HTML body ? when I add something all the content of the Html is replaced by the text I added and the body switch to Text format.... 2) I added an image (logo) to the HTML mail but when the mail is received the place of the image is empty 3) I want to use different color in my Html mail but I fail to use more than one color , it always take the last color I used Tks fo help |
Outlook 2003 Script: HTML Mail
None of your efforts will work because none of them produce valid HTML. In other words, you missed the basic principle I expressed in my earlier message, "... the content HTMLBody must be fully tagged, consistent HTML code, just like in a web
page." You can see this problem if, for example, after these statements execute: myitem.HTMLBody = StrHTML StrHTML = StrHTML & "p" & strDetails & "/p" you look at the value of strHTML. Is it valid HTML? No, because it has a p tag after the closing /html tag. All of your other attempts suffer from the same problem (or worse, they try to insert script, which won't run in HTML messages). Instead of appending text to the existing HTML, you need to ***insert text inside*** the existing HTML content. There are two ways to do that with straightforward text parsing (no need to use the HTML Document itself). These techniques have nothing specific to do with Outlook or HTML, but are the same techniques you could use to turn "this text" into "this insert variable text text": 1) Parse the existing HTML into two sections -- the part before you want to insert your text and the part after -- then concatenate the three: part before & your HTML & part after 2) If you want to append, use the Replace() function to replace the ending /body/html tags with your text followed by /body/html. I find #2 to be by far the easier. -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "news.microsoft.com" wrote in message ... 1)here a part of the code sub SendAlertButton_click() ' THIS IS THE CONTENT OF THE BODY OF MY ' TASK THAT I WANT TO ADD TO THE CONTENT OF HTML MALI StrBB = item.body Set myItem = Application.CreateItem(0) StrHTML = "HTMLbiH1This is the Header of my mail/H1/i/bbrbrhrp align=""center"" img src=""\\MyComputer\myfolder\Images\MyImage.bmp"" /PhrbrbrbrpH2 style=""color:red""This some infomation about the content/H2bra /a/p brPscript type=text/vbscriptdocument.write(item.body)/script/P/HTML" 'HERE ARE THE DIFFERENT THINGS I TRYED StrHTML = StrHTML & "p" & strDetails & "/p" myitem.HTMLBody = StrHTML 'myitem.Body = StrHTML + StrBB myitem.htmlBody = myitem.htmlbody & "HTMLMMMMMMMMMMMMMMMMMMM/HTML" myitem.Display myitem.HTMLBody = StrHTML + StrBB End Sub 1) How to add variable (some text) to the HTML body ? when I add something all the content of the Html is replaced by the text I added and the body switch to Text format.... |
Outlook 2003 Script: HTML Mail
Ok Sue I understand my mistakes I follow your instruction and now it work
fine Now I have to undestand your example on how to insert my image Last thing How can I use the the HTML Format on a task body ?? "Sue Mosher [MVP-Outlook]" a écrit dans le message de news: ... None of your efforts will work because none of them produce valid HTML. In other words, you missed the basic principle I expressed in my earlier message, "... the content HTMLBody must be fully tagged, consistent HTML code, just like in a web page." You can see this problem if, for example, after these statements execute: myitem.HTMLBody = StrHTML StrHTML = StrHTML & "p" & strDetails & "/p" you look at the value of strHTML. Is it valid HTML? No, because it has a p tag after the closing /html tag. All of your other attempts suffer from the same problem (or worse, they try to insert script, which won't run in HTML messages). Instead of appending text to the existing HTML, you need to ***insert text inside*** the existing HTML content. There are two ways to do that with straightforward text parsing (no need to use the HTML Document itself). These techniques have nothing specific to do with Outlook or HTML, but are the same techniques you could use to turn "this text" into "this insert variable text text": 1) Parse the existing HTML into two sections -- the part before you want to insert your text and the part after -- then concatenate the three: part before & your HTML & part after 2) If you want to append, use the Replace() function to replace the ending /body/html tags with your text followed by /body/html. I find #2 to be by far the easier. -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "news.microsoft.com" wrote in message ... 1)here a part of the code sub SendAlertButton_click() ' THIS IS THE CONTENT OF THE BODY OF MY ' TASK THAT I WANT TO ADD TO THE CONTENT OF HTML MALI StrBB = item.body Set myItem = Application.CreateItem(0) StrHTML = "HTMLbiH1This is the Header of my mail/H1/i/bbrbrhrp align=""center"" img src=""\\MyComputer\myfolder\Images\MyImage.bmp"" /PhrbrbrbrpH2 style=""color:red""This some infomation about the content/H2bra /a/p brPscript type=text/vbscriptdocument.write(item.body)/script/P/HTML" 'HERE ARE THE DIFFERENT THINGS I TRYED StrHTML = StrHTML & "p" & strDetails & "/p" myitem.HTMLBody = StrHTML 'myitem.Body = StrHTML + StrBB myitem.htmlBody = myitem.htmlbody & "HTMLMMMMMMMMMMMMMMMMMMM/HTML" myitem.Display myitem.HTMLBody = StrHTML + StrBB End Sub 1) How to add variable (some text) to the HTML body ? when I add something all the content of the Html is replaced by the text I added and the body switch to Text format.... |
Outlook 2003 Script: HTML Mail
You don't. Task bodies are RTF, not HTML. See http://www.outlookcode.com/d/formatmsg.htm
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "bbnimda" wrote in message ... Last thing How can I use the the HTML Format on a task body ?? |
All times are GMT +1. The time now is 11:30 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com