Email for you

Since early versions of the LAS it is possible to send email via e:script. Up to version 6.0 this email distribution was handled with an e:cue server as gateway. From LAS 6.0 SR1 on a direct SMTP interface is available to send mail. Sending an email is helpful when systems run unattended or headless, so there is no way to alert somebody if something strange is going on. You could, for example, combine the script for RDM checking with this  email function to notify somebody about problems with some fixtures.

In any case you need access to an SMTP server as a MTA.

Programmer SMTP configuration

Programmer SMTP configuration

First of all  set the necessary parameters in the Application Options of the Programmer:

  • Name: Set the sender’s name for the FROM field.
  • Email address: The sender’s email address, the FROM address.
  • Server name: The address of the SMTP server
  • Port: The mail port of the server, depends on connection type and is set to values when the connection type is defined. Most servers accept  port 25 („smtp“), newer servers also port 587.
  • Connection security: The security type of the connection. If only notifying about something basic connection security should do.
  • Authentication method: The encryption level for the connection.
  • User name: The user name used to login to the SMTP server.
  • Password: The password for the SMTP server login.

After configuring your SMTP connection you can send email from e:script:

// Generate mail content
int hMailObject = CreateMail(“user@example.com”, 
          “Hello World!”, 
          “The quick brown fox jumps over the lazy dog.”);
AddMailTo(hMailObject, “user@example.com”);
// Schedule mail and remember the message queue ID
int nMessageQueueID = SendMail(hMailObject);
DestroyMail(hMailObject);
// Wait for message being processed
RegisterEvent(Frame, OnFrame);
Suspend();

function OnFrame()
{
   if (MailIsValidID(nMessageQueueID) == 0)
   {
      alert(Unknown mail ID!\n”);
      exit; // shutdown suspended macro event
   }
   // Is message being processed?
   if (MailIsProcessed(nMessageQueueID) == 0)
   {
      printf(“Waiting for message being processed ... \n”);
   }
   else
   {
      printf(“Message was processed.\n”);
      // Is a response available?
      if (MailIsResponseAvailable(nMessageQueueID))
      {
         // Check if sending was successful
         if (MailIsTransmissionSuccessful(nMessageQueueID) == 1)
            printf(“Sending mail successful.\n”);
         else
            alert(“Sending message failed!\n”);
      }
      exit; // Shutdown suspended macro event
   }
}

Leave a Reply

Your email address will not be published. Required fields are marked *