PC Review
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
Send RTF formatted e-mail with outlook
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
Send RTF formatted e-mail with outlook
![]() |
Send RTF formatted e-mail with outlook |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hello,
I want to send an RTF formatted e-mail with Outlook. I read somewhere that just assigning some rtf-code to the Mail.Body property won't work. So I tried the code that I found on http://www.outlookcode.com/d/formatmsg.htm#wordmail (I added this code at the end of this message) Making a new RTF-formatted e-mail works just fine, but the receiver of the message always sees the e-mail as plain text (no matter which e-mail format (plain text, rtf or html) he/she selected). Does anyone know how to send RTF e-mails, so that the receiver also sees the e-mail as RTF? Greetings, Chris Code: Dim objSession, objMessage, objMessageFilter As Object Dim MessageID, cRTF As String Dim bRet As Integer Set objSession = CreateObject("MAPI.Session") objSession.Logon ' Read the first message in the Inbox Set objMessage = objSession.Inbox.Messages(1) objMessage.Update ' to get a permanent Entry ID MessageID = objMessage.ID ' We must initialize the string variable we are passing ' to a string of the maximum length we want to read cRTF = Space(500) bRet = ReadRTF(objSession.Name, objMessage.ID, _ objMessage.StoreID, cRTF) If Not bRet = 0 Then MsgBox "RTF Not Written Successfully" Else MsgBox "RTF Text: " & Chr(13) & cRTF End If Set objMessage = Nothing objSession.Logoff Set objSession = Nothing *** Sent via Developersdex http://www.developersdex.com *** |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Information about your version of Outlook and mail accounts is crucial to understanding your scenario.
-- 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 "Chris Zopers" <test123test12@12move.nl> wrote in message news:Oy28U7P6FHA.3976@TK2MSFTNGP15.phx.gbl... > Hello, > > I want to send an RTF formatted e-mail with Outlook. I read somewhere > that just assigning some rtf-code to the Mail.Body property won't work. > So I tried the code that I found on > http://www.outlookcode.com/d/formatmsg.htm#wordmail (I added this code > at the end of this message) > > Making a new RTF-formatted e-mail works just fine, but the receiver of > the message always sees the e-mail as plain text (no matter which e-mail > format (plain text, rtf or html) he/she selected). > > Does anyone know how to send RTF e-mails, so that the receiver also sees > the e-mail as RTF? > > Greetings, > Chris > > Code: > > Dim objSession, objMessage, objMessageFilter As Object > Dim MessageID, cRTF As String > Dim bRet As Integer > > Set objSession = CreateObject("MAPI.Session") > objSession.Logon > > ' Read the first message in the Inbox > Set objMessage = objSession.Inbox.Messages(1) > objMessage.Update ' to get a permanent Entry ID > MessageID = objMessage.ID > > ' We must initialize the string variable we are passing > ' to a string of the maximum length we want to read > cRTF = Space(500) > bRet = ReadRTF(objSession.Name, objMessage.ID, _ > objMessage.StoreID, cRTF) > > If Not bRet = 0 Then > MsgBox "RTF Not Written Successfully" > Else > MsgBox "RTF Text: " & Chr(13) & cRTF > End If > > Set objMessage = Nothing > objSession.Logoff > Set objSession = Nothing > > *** Sent via Developersdex http://www.developersdex.com *** |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Hello Sue,
I use Microsoft Outlook 2000, but I have the same problem with Microsoft Oulookt 2003..... *** Sent via Developersdex http://www.developersdex.com *** |
|
|
|
#4 |
|
Guest
Posts: n/a
|
And the mail server is?
Also note: The newsgroup interface you are using apparently does not quote earlier messages in the thread, making your latest message so short on detail that you risk not getting the answer you're looking for. Please take the time to quote the original message. -- 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 "Chris Zopers" <test123test12@12move.nl> wrote in message news:enj$z6S6FHA.2600@tk2msftngp13.phx.gbl... > Hello Sue, > > I use Microsoft Outlook 2000, but I have the same problem with Microsoft > Oulookt 2003..... > > > *** Sent via Developersdex http://www.developersdex.com *** |
|
|
|
#5 |
|
Guest
Posts: n/a
|
Hello Sue,
I use Microsoft Outlook 2000, but the same problem occurs with Microsoft Outlook 2003. I do not use a mail server, I send e-mails directly from my local pc with pop3/smtp. When I send the e-mail in RTF format, the e-mail is displayed correctly in my send-items folder in Outlook, but the receiver of the e-mail always sees plain text, no matter which e-mail format (plain text, rtf or html) he/she selected. But when I forward the same e-mail from my send-items folder to the same person, the e-mail is received correctly. So only when sending the e-mail for the first time the problem occurs...... Greetings, Chris. From: Sue Mosher [MVP-Outlook] Date Posted: 11/14/2005 6:56:00 AM Information about your version of Outlook and mail accounts is crucial to understanding your scenario. -- 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 "Chris Zopers" <test123test12@12move.nl> wrote in message news:Oy28U7P6FHA.3976@TK2MSFTNGP15.phx.gbl... > Hello, > > I want to send an RTF formatted e-mail with Outlook. I read somewhere > that just assigning some rtf-code to the Mail.Body property won't work. > So I tried the code that I found on > http://www.outlookcode.com/d/formatmsg.htm#wordmail (I added this code > at the end of this message) > > Making a new RTF-formatted e-mail works just fine, but the receiver of > the message always sees the e-mail as plain text (no matter which > format (plain text, rtf or html) he/she selected). > > Does anyone know how to send RTF e-mails, so that the receiver also sees > the e-mail as RTF? > > Greetings, > Chris > > Code: > > Dim objSession, objMessage, objMessageFilter As Object > Dim MessageID, cRTF As String > Dim bRet As Integer > > Set objSession = CreateObject("MAPI.Session") > objSession.Logon > > ' Read the first message in the Inbox > Set objMessage = objSession.Inbox.Messages(1) > objMessage.Update ' to get a permanent Entry ID > MessageID = objMessage.ID > > ' We must initialize the string variable we are passing > ' to a string of the maximum length we want to read > cRTF = Space(500) > bRet = ReadRTF(objSession.Name, objMessage.ID, _ > objMessage.StoreID, cRTF) > > If Not bRet = 0 Then > MsgBox "RTF Not Written Successfully" > Else > MsgBox "RTF Text: " & Chr(13) & cRTF > End If > > Set objMessage = Nothing > objSession.Logoff > Set objSession = Nothing > > *** Sent via Developersdex http://www.developersdex.com *** *** Sent via Developersdex http://www.developersdex.com *** |
|
|
|
#6 |
|
Guest
Posts: n/a
|
You do indeed use a mail server. It's just running on your local machine.
Can you show the code you're using to set the recipients on the message? -- 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 "Chris Zopers" <test123test12@12move.nl> wrote in message news:%23qonKkT6FHA.2616@TK2MSFTNGP15.phx.gbl... > Hello Sue, > > I use Microsoft Outlook 2000, but the same problem occurs with Microsoft > Outlook 2003. I do not use a mail server, I send e-mails directly from > my local pc with pop3/smtp. > > When I send the e-mail in RTF format, the e-mail is displayed correctly > in my send-items folder in Outlook, but the receiver of the e-mail > always sees plain text, no matter which e-mail format (plain text, rtf > or html) he/she selected. But when I forward the same e-mail from my > send-items folder to the same person, the e-mail is received correctly. > So only when sending the e-mail for the first time the problem > occurs...... > > Greetings, > Chris. > > > From: Sue Mosher [MVP-Outlook] > Date Posted: 11/14/2005 6:56:00 AM > > > > Information about your version of Outlook and mail accounts is crucial > to understanding your scenario. > > "Chris Zopers" <test123test12@12move.nl> wrote in message > news:Oy28U7P6FHA.3976@TK2MSFTNGP15.phx.gbl... >> Hello, >> >> I want to send an RTF formatted e-mail with Outlook. I read somewhere >> that just assigning some rtf-code to the Mail.Body property won't > work. >> So I tried the code that I found on >> http://www.outlookcode.com/d/formatmsg.htm#wordmail (I added this code >> at the end of this message) >> >> Making a new RTF-formatted e-mail works just fine, but the receiver of >> the message always sees the e-mail as plain text (no matter which >> format (plain text, rtf or html) he/she selected). >> >> Does anyone know how to send RTF e-mails, so that the receiver also > sees >> the e-mail as RTF? >> >> Greetings, >> Chris >> >> Code: >> >> Dim objSession, objMessage, objMessageFilter As Object >> Dim MessageID, cRTF As String >> Dim bRet As Integer >> >> Set objSession = CreateObject("MAPI.Session") >> objSession.Logon >> >> ' Read the first message in the Inbox >> Set objMessage = objSession.Inbox.Messages(1) >> objMessage.Update ' to get a permanent Entry ID >> MessageID = objMessage.ID >> >> ' We must initialize the string variable we are passing >> ' to a string of the maximum length we want to read >> cRTF = Space(500) >> bRet = ReadRTF(objSession.Name, objMessage.ID, _ >> objMessage.StoreID, cRTF) >> >> If Not bRet = 0 Then >> MsgBox "RTF Not Written Successfully" >> Else >> MsgBox "RTF Text: " & Chr(13) & cRTF >> End If >> >> Set objMessage = Nothing >> objSession.Logoff >> Set objSession = Nothing >> >> *** Sent via Developersdex http://www.developersdex.com *** > > > *** Sent via Developersdex http://www.developersdex.com *** |
|
|
|
#7 |
|
Guest
Posts: n/a
|
Hello Sue,
The actual code I'm using is the code I found at http://www.outlookcode.com/d/formatmsg.htm#wordmail. I've downloaded a dll from that website (mapirtf.dll) and placed it in my system32 directory. Here's all code I'm using. This code assumes you have already a variable (cRTF) which contains some RTF-text. This code opens/shows a new e-mail in RTF-Format. In that e-mail I just type a recipient and I send the mail manually by clicking the outlook-button 'send and receive'. In my send-items folder, the e-mail is displayed correctly in RTF format, but the recipient just sees plain text. Public Declare Function WriteRTF _ Lib "mapirtf.dll" _ Alias "writertf" (ByVal ProfileName As String, _ ByVal MessageID As String, _ ByVal StoreID As String, _ ByVal cText As String) _ As Integer Public Declare Function ReadRTF _ Lib "mapirtf.dll" _ Alias "readrtf" (ByVal ProfileName As String, _ ByVal SrcMsgID As String, _ ByVal SrcStoreID As String, _ ByRef MsgRTF As String) _ As Integer Public Sub SendEmail Dim objSession, objMessage, objMessageFilter As Object Dim MessageID, cRTF As String Dim bRet As Integer Set objSession = CreateObject("MAPI.Session") objSession.Logon ' Read the first message in the Inbox Set objMessage = objSession.Inbox.Messages(1) objMessage.Update ' to get a permanent Entry ID MessageID = objMessage.ID ' We must initialize the string variable we are passing ' to a string of the maximum length we want to read cRTF = Space(500) bRet = ReadRTF(objSession.Name, objMessage.ID, _ objMessage.StoreID, cRTF) If Not bRet = 0 Then MsgBox "RTF Not Written Successfully" Else MsgBox "RTF Text: " & Chr(13) & cRTF End If Set objMessage = Nothing objSession.Logoff Set objSession = Nothing End Sub *** Sent via Developersdex http://www.developersdex.com *** |
|
|
|
#8 |
|
Guest
Posts: n/a
|
After you type in the recipient, click the Check Names button on the toolbar to resolve the name. Then double-click the underlined name and make sure the recipient is set for "Send in Outlook rich text format."
-- 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 "Chris Zopers" <test123test12@12move.nl> wrote in message news:%23xtB5oe6FHA.3232@TK2MSFTNGP15.phx.gbl... > Hello Sue, > > The actual code I'm using is the code I found at > http://www.outlookcode.com/d/formatmsg.htm#wordmail. I've downloaded a > dll from that website (mapirtf.dll) and placed it in my system32 > directory. Here's all code I'm using. This code assumes you have already > a variable (cRTF) which contains some RTF-text. This code opens/shows a > new e-mail in RTF-Format. In that e-mail I just type a recipient and I > send the mail manually by clicking the outlook-button 'send and > receive'. In my send-items folder, the e-mail is displayed correctly in > RTF format, but the recipient just sees plain text. > > Public Declare Function WriteRTF _ > Lib "mapirtf.dll" _ > Alias "writertf" (ByVal ProfileName As String, _ > ByVal MessageID As String, _ > ByVal StoreID As String, _ > ByVal cText As String) _ > As Integer > > Public Declare Function ReadRTF _ > Lib "mapirtf.dll" _ > Alias "readrtf" (ByVal ProfileName As String, _ > ByVal SrcMsgID As String, _ > ByVal SrcStoreID As String, _ > ByRef MsgRTF As String) _ > As Integer > > Public Sub SendEmail > > Dim objSession, objMessage, objMessageFilter As Object > Dim MessageID, cRTF As String > Dim bRet As Integer > > Set objSession = CreateObject("MAPI.Session") > objSession.Logon > > ' Read the first message in the Inbox > Set objMessage = objSession.Inbox.Messages(1) > objMessage.Update ' to get a permanent Entry ID > MessageID = objMessage.ID > > ' We must initialize the string variable we are passing > ' to a string of the maximum length we want to read > cRTF = Space(500) > bRet = ReadRTF(objSession.Name, objMessage.ID, _ > objMessage.StoreID, cRTF) > > If Not bRet = 0 Then > MsgBox "RTF Not Written Successfully" > Else > MsgBox "RTF Text: " & Chr(13) & cRTF > End If > > Set objMessage = Nothing > objSession.Logoff > Set objSession = Nothing > > End Sub > > *** Sent via Developersdex http://www.developersdex.com *** |
|
|
|
#9 |
|
Guest
Posts: n/a
|
Hello Sue,
When I doubleclick on the e-mail adress of the recipient, the properties dialog is shown. On the 'Name' tab, I see a checkbox called 'e-mail only as unformatted text' (I use a dutch version of outlook, so I don't know the exact description of the checkbox in english). But I don't see an option like 'Send in Outlook rich text format'. Where should this option be? Greetings, Chris. *** Sent via Developersdex http://www.developersdex.com *** |
|
|
|
#10 |
|
Guest
Posts: n/a
|
You're not using Outlook 2000 in IMO mode are you?
-- 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 "Chris Zopers" <test123test12@12move.nl> wrote in message news:uOAmHCo6FHA.744@TK2MSFTNGP10.phx.gbl... > Hello Sue, > > When I doubleclick on the e-mail adress of the recipient, the properties > dialog is shown. On the 'Name' tab, I see a checkbox called 'e-mail only > as unformatted text' (I use a dutch version of outlook, so I don't know > the exact description of the checkbox in english). > > But I don't see an option like 'Send in Outlook rich text format'. Where > should this option be? > > Greetings, > Chris. > > > *** Sent via Developersdex http://www.developersdex.com *** |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

