Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Attaching files to server-scheduled emails

Featured Replies

How can I attach a file stored in SC to an email being generated and sent using a scheduled script? I know the companion plug-in is required and I've got that setup, but I'm not sure about the rest.. Any advice would be most welcome in helping me avoid expending the time for trial and error..

TIA,

Aaron

Use SCGetContainer to get the file you want to use as at attachment.

EmailAttachFile(SCGetContainer($pathToFile))

  • Author

Hmm.. Something is still amiss..

In my scheduled script I have the following:

Set Variable [ $result; Value:SCSetBaseURL( RES__Resources::SC_Path ) ]

Set Variable [ $attachmentPath; Value:SCGetContainer( "Email/" & Email::__kpEmailID.n) ]

Send Mail [ Send via SMTP Server; No Dialog; To: $to ; CC: $cc ; BCC: $bcc ; Subject: $subject ; Message: $message ; $attachmentPath

If I run though debugger, the $attachmentPath var is never declared. This seems correct since you can't store binary data in a var. Can you clarify? It could be that I'm too close to see the answer, but I've played with this a bit and I'm not having luck. The email is sent successfully, but with no attachment.

Thoughts?

Thanks,

Aaron

Hmm.. Something is still amiss..

In my scheduled script I have the following:

Set Variable [ $result; Value:SCSetBaseURL( RES__Resources::SC_Path ) ]

Set Variable [ $attachmentPath; Value:SCGetContainer( "Email/" & Email::__kpEmailID.n) ]

Send Mail [ Send via SMTP Server; No Dialog; To: $to ; CC: $cc ; BCC: $bcc ; Subject: $subject ; Message: $message ; $attachmentPath

If I run though debugger, the $attachmentPath var is never declared. This seems correct since you can't store binary data in a var. Can you clarify? It could be that I'm too close to see the answer, but I've played with this a bit and I'm not having luck. The email is sent successfully, but with no attachment.

Thoughts?

Thanks,

Aaron

Hi Aaron - you're correct, I don't think it's possible to store binary data into a variable. Try using a Set Field with a global field instead of a global variable. Verify that you're actually getting the data into the container field before you try attaching it as an e-mail, so that you can separate the SuperContainer aspect of this from the e-mail aspect.

  • Author

Thanks Jesse and David.

I was able to get it working with some additional steps. Since you cannot export field contents with a script run from server, a global won't work. I did find, however, that I could use the SCDownload () function to download the file to a temp directory on the server. I also used the SCGetInfo () function, wrapped in a GetValue () function to grab the file name. Here's the steps:

Set Variable [ $result; Value:SCSetBaseURL( RES__Resources::SC_Path ; RES__Resources::SC_Username ; RES__Resources::SC_Password )]

Set Variable [ $result; Value:SCDownload( "Email" & Email::__kpEmailID.n & "/1/" ; Get ( TemporaryPath )]

Set Variable [ $filename; Value:GetValue ( SCGetInfo( "Email" & Email::__kpEmailID.n ) ; 1 )]

Set Variable [ $attachmentPath; Value:Get ( TemporaryPath ) & $filename ]

Send Mail [ Send via SMTP Server; No Dialog; To: $to ; CC: $cc ; BCC: $bcc ; Subject: $subject ; Message: $message ; $attachmentPath]

I hope this helps others..

Thanks again for your prompt replies both on and offline.

Regards,

Aaron

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.