Forwarding Messages
Topic Last Modified: 2006-06-12
You can forward an existing message by 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 To property in the new message before you send the message.
Example
Visual Basic
' Reference to Microsoft ActiveX Data Objects 2.5 Library
' Reference to Microsoft CDO for Exchange 2000 Server Library
' It is recommended that all input parameters be validated when they are
' first obtained from the user or user interface.
Sub ForwardMessage(iMsg As CDO.Message)
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
End Sub
C++, IDL
#import "c:\program files\common files\system\ado\msado15.dll" no_namespace
#import "c:\program files\common files\microsoft shared\cdo\cdoex.dll" no_namespace
// It is recommended that all input parameters be validated when they are
// first obtained from the user or user interface.
void forwardMessage( IMessagePtr& iMsg ) {
// want to reply all
IMessagePtr iMsg2;
iMsg2 = iMsg->Forward();
// iMsg2 = iMsg->Reply();
// iMsg2 = iMsg->PostReply();
// add any other recipients
iMsg2->TextBody = "I agree...please proceed." + "\r\n" + iMsg2->TextBody;
try {
iMsg2->Send();
}
catch(_com_error e) {
throw e;
}
}
VBScript
Dim iDropDir
Dim iMsgs
Dim iMsg
Set iDropDir = CreateObject("CDO.DropDirectory")
Set iMsgs = iDropDir.GetMessages("c:\\Inetpub\\mailroot\\Drop")
Set iMsg = iMsgs(1)
' want to reply all
Dim iMsg2
Set iMsg2 = iMsg.Forward
' ... configure message object
' add any other recipients
iMsg2.TextBody = "You missed this: " & vbCrLf & iMsg2.TextBody
iMsg2.Send