1. Home
  2. Knowledge Base
  3. GMS
  4. How do I create an e-mail with an attachment using MML?

How do I create an e-mail with an attachment using MML?

Question

Automated emails containing file attachments can be created easily using a small MML script. Where this script is placed and how it is called would depend on exactly when you want it to run.

For instance, you may want to send a file at midnight every night containing details of work processed in the previous 24 hours.

To do this you would enter the MML script as a timed event, entering the time for it to run and the frequency with which it should run. Timed events are set up from the System > Timed Events page.

Answer

The code is straightforward in MML, and would look similar to the following.

Msg = MsgCreate("UserSend@domain.dom","UserReceive@domain.dom","Test Message");

If (Msg)
{
MsgAddFile(Msg,"\TheFile.txt",FILE_TEXT);
MsgClose(Msg,MSG_SEND);
}

This script would send out an e-mail from "UserSend@domain.dom" to "UserReceive@domain.dom" with the subject "Test Message". A file, located in the gordano base directory, called "TheFile.txt" is then attached in TEXT format.

Keywords:Mml, attachment, file, script, timed events

Was this article helpful?

Related Articles

Contents

Need Support?

Can't find the answer you're looking for?
Contact Support