Cicode Programming Reference > Cicode Function Categories > Mail Functions Introduction > MailSend


Sends a standard mail message. The mail message can contain text, an attached file, or both.

Before you can use this function, you need to use the MailLogon() function to log on to the mail system. You can only send mail from the user name specified in the MailLogon() function. You can send mail to any mail user or to another Citect client.


MailSend(sName, sSubject, sNote, sFileName, iMode)


The name of the mail user who will receive the message. This name is the user's full name (not their mailbox name).


The subject text of the mail message (a short description of what the message is about).


The note section of the message (the main section of the message text). You can enter up to 255 characters, or a file name for longer messages. If you enter a file name, set iMode to 1.


The name of any attached file. If there is no attached file in the message, set sFileName to an empty string "".


The mode of the send:

0 - Normal mail message.

1 - The sNote argument is the name of a text file to send as the note.

Return Value

0 (zero) if successful, otherwise an error is returned.

Related Functions

MailLogon, MailLogoff, MailRead, MailError


! Logon to the mail system
MailLogon("Wombat", "password", 0);
! send the report to Andrew
MailSend("Andrew Bennet", "Report", "Attached is the weekly report", "[data]:weekly.txt", 0);
! send hello message to JR
MailSend("Jack Russell", "Hello", "You've only got yourself to blame!", "", 0);
! send a big note to Nigel
MailSend("Nigel Colless", "Big Message", "[data]:message.txt", "", 1);

See Also

Mail Functions