Send multiple attachments in one email?

Ask general questions here.
karltinsly
Posts: 43
Joined: Tue Jun 07, 2016 9:59 pm

Send multiple attachments in one email?

Post by karltinsly » Tue May 30, 2023 9:57 pm

Is it possible to send multiple attachments in a single email using the email helpers? I've tried separating the filenames in a parameter with a semi-colon (also tried a comma), like so: c:\test\test01.txt; c:\test\test02.txt but it didn't work. I couldn't find the answer in any of the documentation so I thought I'd ask here. Thanks!

User avatar
doke
Posts: 112
Joined: Fri Mar 29, 2019 2:33 pm

Re: Send multiple attachments in one email?

Post by doke » Wed May 31, 2023 2:04 pm

Can be done, depending on your coding skills :)

Atttachments are passed as a array of strings :
[UserCodeMethod]
            public static bool SendEmail(
                string subject,
                string to,
                string from,
                string body,
                string[] attachments,
                string serverHostname,
                int serverPort,
                bool useSSL = false,
                string username = "",
                string password = "")
so you need to load the attachements and return them as string ( see the CreatePdfReport and/or CreateCompressedReport functions in Emailmodule)

good luck!,

Don