ACF Library

emailServerPar

Back to List

Description: Create a JSON object with the server config for use in E-mail sending.

FileMaker Prototype:

Set Variable [$res; ACF_Run("emailServerPar"; string_ShortName)]

Category: EMAIL

NOTE: This function serves as a reference template. To use it effectively, you may need to adjust certain parts of the code, such as field names, database structures, and specific data lists to fit the requirements of your system. This customization allows the function to work seamlessly within your environment.

Function source:

function emailServerPar (string ShortName)

   ARRAY string SMTP_Host, SMTP_User, SMTP_Password, SMTP_Port, FromEmail,  FromName, Signature, PlainSignature;

   string sql = "SELECT
       SMTP_Host,
       SMTP_User,
       SMTP_Password,
       SMTP_Port,
       FromEmail,
       FromName,
      Signature,
      PlainSignature
   FROM
       Email_Accounts
   WHERE
       ShortName = :ShortName

   INTO  :SMTP_Host, :SMTP_User, :SMTP_Password, :SMTP_Port, :FromEmail,  :FromName, :Signature, :PlainSignature
   ";

   string res = ExecuteSQL (sql); 
   if ( sizeof (SMTP_User) == 0) then
      return json("ERROR", "No Data retrieved in SQL query", "shortname", ShortName); 
   end if

   JSON server;
   server["server"] = JSON ("host", SMTP_Host[1], "port", SMTP_Port[1], "user", SMTP_User[1], 
                  "password",SMTP_Password[1], "Signature", Signature[1],"PlainSignature", PlainSignature[1] ); 
   return server; 
end

Back to List