VBScript in a custom form cannot send out another email?

B

Bingo

In my custom form, I've the following VBScript code to
create a new mail item off the out-going one and send it
out as well. But the Send method generates an error for
no support for update. Any recommendations? Thanks.


Dim oNsp ' Outlook Namespace
Dim oMapiMail ' Outlook Mail Item
Dim sMailbox ' Mailbox Name
Dim sOriginalFrom ' Sender's Name
Dim sOriginalTo ' Recipient's Name (To)
Dim sOriginalCC ' Recipient's Name (CC)
Dim oRdpMailItem ' Redemption Safe Mail Item
Dim sMailID ' Outlook Mail Item Entry ID
Dim lCnt ' Recipient Counter
Dim lTotal ' Total Number of Recpients
Dim sRdpRecipient ' Redemption Recpient

Function Item_Send()

' Only process outgoing emails using the custom form
If Item.UserProperties("Mailbox") Is Nothing Then
Msgbox "Not a Custom Form"
Exit Function
Else
If Item.UserProperties("Direction")
<> "O" Then
MsgBox "Not an Outgoing Message"
Exit Function
End if
End If

Set oNsp = Item.Session
sOriginalFrom = oNsp.CurrentUser

Set oMapiMail = Item.Copy
With oMapiMail
.UserProperties("OriginalFrom") =
sOriginalFrom
End With

Item.MessageClass = "IPM.Note"

oMapiMail.Save
sMailID = oMapiMail.EntryID
Set oMapiMail = Nothing
Set oMapiMail = oNsp.GetItemFromID(sMailID)

Set oRdpMailItem = CreateObject
("Redemption.SafeMailItem")
oRdpMailItem.Item = oMapiMail

sOriginalTo = oRdpMailItem.To

lTotal = oRdpMailItem.Recipients.Count
For lCnt = lTotal To 1 Step -1
oRdpMailItem.Recipients.Remove lCnt
Next

Set sRdpRecipient = oRdpMailItem.Recipients.Add
(sMailbox)
sRdpRecipient.Type = 1
' The following two lines both failed
' oRdpMailItem.Send
oMapiMail.Send
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top