Skip to main content
Question

Existing API to send email + attachment

  • May 29, 2026
  • 4 replies
  • 36 views

athobie
Sidekick (Partner)
Forum|alt.badge.img+11

Hi

Could you please tell us if there's an API that allows sending emails with attachments?
(with the idea of identifying the ID of the attachment and with it sending the email)

Thanks in advance for your help.

Regards

anthony

4 replies

Reid Gilbert
Superhero (Employee)
Forum|alt.badge.img+15
  • Superhero (Employee)
  • May 29, 2026

Hi Anthony,
I’m not sure if there’s a direct API that does all of that, but you could do it through a MACRO call via an API, the mobile app does something similar currently by calling the SERVICEORDERREPORTWSIGNATUREEMAIL macro (this macro basically generates the report, saves it off as a .pdf file, then sends out an e-mail with that .pdf file as an attachment on it), so you can probably clone this macro and just change the logic a bit so that it adds your attachment instead of creating the report:

<root xmlns:dt="urn:schemas-microsoft-com:datatypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://astea.com.schema.bc.Service_Order">
  <session email="" alias="">
    <state bc_name="Service_Order">
      <action name="declare">
        <attribute dtype="string" in_var="" out_var="" name="strOrderID" value="" operator="=" />
      </action>
      <action name="getdescrex">
        <attribute in_var="" out_var="strOrderID" entity_name="service_order" key_name="surrogate_order_id" element_name="order_id" key_value="SV2604181042@@1" default_value="SV2604181042@@1" />
      </action>
      <action name="execmacro">
        <attribute bo_name="main" macro_name="SERVICEORDERREPORTWSIGNATUREEMAIL" />
        <attribute dtype="string" in_var="strOrderID" value="in_var" />
        <attribute dtype="array" in_var="" value="reid.gilbert@ifs.com" />
        <attribute dtype="array" in_var="" value="" />
        <attribute dtype="array" in_var="" value="" />
        <attribute dtype="string" in_var="" value="donotreply@MyCompany.com" />
        <attribute dtype="string" in_var="" value="Service Order Report: SV2604181042@@1" />
        <attribute dtype="string" in_var="" value="Dear customer, please find attached the Service Order Report for Work Order: SV2604181042@@1." />
        <attribute dtype="string" in_var="" value="FX_Service_Order_Report" />
        <attribute dtype="string" in_var="" value="cd0eefdf-f766-834d-35e9-818addb2deca" />
      </action>
    </state>
  </session>
</root>

Thanks,
Reid


Franck.G
Sidekick (Employee)
Forum|alt.badge.img+8
  • Sidekick (Employee)
  • May 29, 2026

The documentation is available; if you need any information, you can contact me by email


Reid Gilbert
Superhero (Employee)
Forum|alt.badge.img+15
  • Superhero (Employee)
  • May 29, 2026

I gave it a quick scan, but I don’t think that’s going to help them accomplish this request within the Alliance application.
Thanks,
Reid


athobie
Sidekick (Partner)
Forum|alt.badge.img+11
  • Author
  • Sidekick (Partner)
  • May 29, 2026

Hi ​@Reid Gilbert 

Thanks Reid for your help.

We know this API (see below)
 

<!--
API Description: This API Sends an email with attachment
Each pattern surrounded by {} needs to be replaced with an actual value. 
For more information on the Astea API syntax see topic API Language in the User Guides –> Integration Guide
-->

 

<root xmlns:dt="urn:schemas-microsoft-com:datatypes">
<session email="" alias="">
<state bc_name="communication">
<action name="execmacro">
<attribute bo_name="main" macro_name="NewWithParams" />
<macro_params>
<columns>
<value>cc_type</value>
<value>cc_email_to</value>
<value>cc_email_subject</value>
<value>cc_email_body</value>
<value>cc_temp_directory_name</value>
</columns>
<values>
<value dtype="string">email</value>
<value dtype="string">{Your Email Address}</value>
<value dtype="string">subject</value>
<value dtype="string">{Email Subject}</value>
<value dtype="string">{The Directory Name in the Shared  Location on  The APP Server where the file exists}</value>
</values>
</macro_params>
</action>
<action name="execmacro">
<attribute bo_name="main" macro_name="ComSendMessage" />
<attribute dtype="array" in_var="" value="{The Full path  of the file}" />
</action>
</state>
</session>
</root>


We want something like that, BUT With an attachment ID, because we don't want to use the attachment path for security reasons 

Do you know a way to avoid the path of attachment in the API and to use the ID of the attachment ?

Thanks and Regards
anthony