| Platform SDK: CDO for Windows 2000 |
You can forward an existing message using the IMessage.Forward method. The Forward method retains all the attachments from the original message, but does not set any recipients on the new message. You must set the IMessage.To property in the new message before you send the message.
' Reference to Microsoft ActiveX Data Objects 2.5 Library
' Reference to Microsoft CDO for Windows 2000 Library
Dim iMsgs as CDO.IMessages
Dim iDropDir as New CDO.DropDirectory
Dim iMsg as CDO.Message
Set iMsgs = iDropDir.GetMessages("c:\Inetpub\mailroot\Drop");
Set iMsg = iMsgs(1)
' want to reply all
Dim iMsg2 as CDO.Message
Set iMsg2 = iMsg.Forward
' ..configure message object
' add any other recipients
iMsg2.TextBody = "You missed this: " & vbCrLf & iMsg2.TextBody
iMsg2.Send
#import "c:\program files\common files\system\ado\msado15.dll" no_namespace
#import <cdosys.dll> no_namespace
// ...
IDropDirectoryPtr iDropDir(__uuidof(DropDirectory));
IMessagesPtr iMsgs;
IMessagePtr iMsg;
iMsgs = iDropDir->GetMessages("c:\\Inetpub\\mailroot\\Drop");
iMsg = iMsgs->Item[1];
// want to reply all
IMessagePtr iMsg2;
iMsg2 = iMsg->Forward();
// add any other recipients
iMsg2->TextBody = "You missed this: " + "\r\n" + iMsg2->TextBody;
iMsg2->Send();
Const g_bDebug = True
Dim iDropDir
Dim iMsgs
Dim iMsg
Dim iMsg2
Dim iConf
Dim Flds
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
Flds(cdoUseMessageResponseText) = True
' Get Language code for the user. Here we set "en-us"
' for US English. This code affects the language
' of the response text.
Flds(cdoLanguageCode) = "en-us"
Flds.Update
Set iDropDir = CreateObject("CDO.DropDirectory")
Set iMsgs = iDropDir.GetMessages("c:\Inetpub\mailroot\Drop")
If iMsgs.Count > 0 Then
' User views message 1
Set iMsg = iMsgs(1)
' Display message here
' Did author request an MDN?
If iMsg.MDNRequested Then
' Ask user whether to send the MDN
End If
' Forward using SMTP
Set iMsg2 = iMsg.Forward
Set iMsg2.Configuration = iConf
iMsg2.To = "friend@microsoft.com"
iMsg2.CC = "distribution_list@microsoft.com"
iMsg2.TextBody = "You missed this." & vbCrLf & iMsg2.TextBody
If g_bDebug Then
MsgBox iMsg2.GetStream.ReadText
Else
iMsg2.Send
End If
End If
http://schemas.microsoft.com/cdo/configuration/usemessageresponsetext