/ Forums / Advansys Formativ / Creating Solutions with Formativ / Attach Original Message / Reply To: Attach Original Message
‘——————————————————————————-
‘ Insert your comments here
‘——————————————————————————-
Sub Main(Client, GWEvent)
Dim objDraft
Dim objEmail
Dim objRecipient
Dim Archief
‘ Maak een nieuw bericht
Set objDraft = GoupWise.Account.MailBox.Messages.Add(4)
‘ Voeg een ontvanger in
Archief = “test@test.com
objRecipient = objDraft.Recipients.Add(Archief,,0)
‘ Voeg parameters toe
Set Msg = Client.ClientState.CommandMessage
objDraft.Subject = “Archivering gewenst”
objDraft.BodyText.PlainText = “Graag dit bericht archiveren.”
‘ call objDraft.Attachments.Add(Msg, “Test”)
‘ Verstuur het bericht dmv de verzend methode
Set objEmail = objDraft.Send
‘ Verzend bevestiging
Call MsgBox(“Dank U.”, 64, “Bericht verzonden.”)
End Sub
=============================================
In this case the message is generated, and send to the recipient, as soon as I enable the attachment line (call objDraft.Attachments.Add(Msg, “Test”)) the message is not send, but comes back into my own mailbox as a draft without recipient. Can you please provide me with a working script to attach the original message and send it to a single recipient (in this case test@test.com).
An other problem I have is that: when I do not have a message selected it fails on the following line:
Set Msg = Client.ClientState.CommandMessage
How can I check if there is a message selected?
Thanks already for your help so far.