/ Forums / Advansys Formativ / Creating Solutions with Formativ / Trusted Application and Multiple Logins / Reply To: Trusted Application and Multiple Logins

#6955
stuartcross
Participant

A little more progress

I have rewritten the SendMail function and am now able to get it to send emails from the specific user. The problem I am now having is actually attaching the emails to this new mail. The new SendMail function is below. The problem lies within the for statement. I am unsure what the command/syntax is to attach the mails to this new email. I have tried both methods which are commented out without success.

Thanks,

Stuart

function SendMail

dim MyArray
dim objMail
dim objNewMail
dim objRecipient
dim objAttachments

‘ Create a draft mail message with no user interface
Set objMail = iAccount.MailBox.Messages.Add(“GW.MESSAGE.MAIL”, fgwDraft)
Set objRecipient = objMail.Recipients.Add(MANAGER,,0)
With objMail
.Priority = fgwNormal
.Subject = “Unopened Messages within 2 hour period”
.BodyText.PlainText = HRT&HRT&HRT&”Forwarded Messages from : “&(iAccount.Owner)&HRT&HRT&”The attached messages have not been opened within the 2 hour period”
End With
for x = 0 to (StringList.Count -1)
MyArray = Split(StringList.Strings(x), ” !! “, -1, 1)
‘call objMail.Attachment.Add(MyArray(3)) ‘
‘call objMail.AttachmentAddEncapsulatedItem(MyArray(3))
next
Set objNewMail = objMail.Send
Set objRecipient = Nothing
Set objMail = Nothing

end function