PC Review


Reply
Thread Tools Rate Thread

Send RTF formatted e-mail with outlook

 
 
Chris Zopers
Guest
Posts: n/a
 
      14th Nov 2005
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 ***
 
Reply With Quote
 
 
 
 
Sue Mosher [MVP-Outlook]
Guest
Posts: n/a
 
      14th Nov 2005
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" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> 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 ***

 
Reply With Quote
 
Chris Zopers
Guest
Posts: n/a
 
      14th Nov 2005
Hello Sue,

I use Microsoft Outlook 2000, but I have the same problem with Microsoft
Oulookt 2003.....


*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
Sue Mosher [MVP-Outlook]
Guest
Posts: n/a
 
      14th Nov 2005
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" <(E-Mail Removed)> wrote in message news:enj$(E-Mail Removed)...
> Hello Sue,
>
> I use Microsoft Outlook 2000, but I have the same problem with Microsoft
> Oulookt 2003.....
>
>
> *** Sent via Developersdex http://www.developersdex.com ***

 
Reply With Quote
 
Chris Zopers
Guest
Posts: n/a
 
      14th Nov 2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 ***



*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
Sue Mosher [MVP-Outlook]
Guest
Posts: n/a
 
      15th Nov 2005
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" <(E-Mail Removed)> wrote in message news:%(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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 ***

>
>
> *** Sent via Developersdex http://www.developersdex.com ***

 
Reply With Quote
 
Chris Zopers
Guest
Posts: n/a
 
      15th Nov 2005
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 ***
 
Reply With Quote
 
Sue Mosher [MVP-Outlook]
Guest
Posts: n/a
 
      15th Nov 2005
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" <(E-Mail Removed)> wrote in message news:%(E-Mail Removed)...
> 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 ***

 
Reply With Quote
 
Chris Zopers
Guest
Posts: n/a
 
      16th Nov 2005
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 ***
 
Reply With Quote
 
Sue Mosher [MVP-Outlook]
Guest
Posts: n/a
 
      16th Nov 2005
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" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> 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 ***

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I send a HTML formatted e-mail from Access through Lotus No =?Utf-8?B?QWRhbSBUaHdhaXRlcw==?= Microsoft Access 0 15th Oct 2007 04:02 PM
how to send html formatted mail from SMTP to Outlook? nickelstat@sbcglobal.net Microsoft Outlook Discussion 2 7th Jul 2006 07:37 PM
Send RTF formatted e-mails with outlook Chris Zopers Microsoft Dot NET Framework Forms 0 14th Nov 2005 10:37 AM
How do I send a Dreamweaver formatted HTML message using Outlook . =?Utf-8?B?U3RvcnN2ZW4=?= Microsoft Outlook Discussion 1 23rd Jan 2005 07:26 PM
How can I send a formatted email within Microsoft Outlook? =?Utf-8?B?QW5kcmVzIFA3Ng==?= Microsoft Outlook Discussion 1 1st Oct 2004 09:26 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:56 PM.