Applies To:
  • CitectSCADA 5.xx
  • CitectHMI 5.xx

Summary:
Citect's Mail (MAPI) functions only allow you to send e-mails to one contact at a time. Is there a way I can send the same e-mail to multiple recipients? 

Solution:
Since concatenating the sName string argument for the Cicode MailSend function does not allow you to send e-mails to multiple recipients (e.g. "RecipientName" + "RecipientName"), you must configure a distribution list in Microsoft Outlook to be comprised of several contacts:

1. Go to Tools menu | Address Book

2. In the 'Show Names from the' drop-down list, select Contacts

3. Go to File menu | New Entry

4. Select New Distribution List and click OK

5. In the Name field, type a unique name for the distribution list

6. Click on the Select Members button to add contacts

7. Click on the Save and Close button when finished

Below is some sample code which could be called from a command button or event:

FUNCTION MAPI_Test()
    !confirm path to Outlook.exe program on your system before calling Exec command
    Exec("C:\Program Files\Microsoft Office\Office\Outlook.exe");
    Sleep(5);
    MailLogon("SenderName", "", 0);
    MailSend("DistributionListName", "Test", "This is a test", "" , 0);
        !sends without an attachment
    MailLogoff();
END

FUNCTION MAPI_Test2()
    !confirm path to Outlook.exe program on your system before calling Exec command
    Exec("C:\Program Files\Microsoft Office\Office\Outlook.exe");

    Sleep(5);
    MailLogon("SenderName", "", 0);
    MailSend("DistributionListName", "Test", "This is a test", "[DATA]:Message.txt" , 0);
    !sends with an attachment
    MailLogoff();
END

Note: Test results show that sending e-mails to a distribution list (group) configured in Microsoft Outlook Express does NOT work. You must have Microsoft Outlook 97 or 2000. Refer to Knowledge Base Article Q3748 for more details concerning the Cicode MAPI functions.

 

Keywords:
MAPI, Messaging Application Programming Interface  

Attachments