Community
Showing results for 
Search instead for 
Do you mean 
Reply

ACT SDK Send Email with Attachment

New Member
Posts: 2
Country: USA

ACT SDK Send Email with Attachment

Hello all,

 

I am developing an plugin for ACT 2011 that is close to complete.  I have a user control that will send an email to a contact as well as perform some other functions once a button is clicked.  I have the email working, but I cannot figure out how to add an attachment to the email.

 

I am using the following VB code to create an send the email.  When attachments is set to null the email sends, just without any attachments.  I know that the last variable needs to be set to a StringCollection based on the code reference, but I am getting an "Object reference not set to an instance of an object" error when I try and send this email.

 

Dim attachments As StringCollection
attachments.Add("C:\test.jpg")

HostApplication.UIEmailManager.SendEmailToContact(Me.HostApplication.ApplicationState.CurrentContact, message, subject, Act.Framework.Preferences.Enums.EmailCreateHistoryType.SubjectAndMessage, False, False, attachments)

 

Any ideas how to add an attachment to an email this way?  I know it can be done I just do not know what to set the string collection to in order to get ACT to find and attahch the image.

 

Thanks!

New Member
Posts: 2
Country: USA

Re: ACT SDK Send Email with Attachment

Nevermind, I figured it out.  I just had to change the declaration to 

 

Dim attachments = New System.Collections.Specialized.StringCollection()