company logo

Email - Sending and receiving emails

The class supports sending and receiving emails. Email messages have to be constructed from email properties as sender and receiver, subject and message (body). Before sending an email, message and all attachments have to be added to the email. Usually, also sender, receiver, host, and port have to be provided.

When cURL library is not supported or when using port 25, emails are sent using POP before SMPT. When cURL library is supported, encrypted emails can be sent using SSL including certificate verification for host and client.

Alternatively, emails might be send via an external email program configured in the Options.Email.Command option variable.

Before sending the email, subject() , body() (and html_body() ) have to be filled. When appending documents ( append() ), it has to be done after filling the message. When filling subject and body, only, a plain text message will be submitted.

In order to make email parameters configurable, email options may be used instead of passing parameters to the functions.

// osi fragment

bool static sendMail () {

VARIABLES

  Email         mail;

PROCESS

  mail.open(); // explicit open required in OSI, only

  mail.host("my_server.com");

  mail.port(465);

  mail.sender("me@my_server.com");

  mail.receiver("you@gmx.de");

  mail.subject("Test mail");

  mail.body("This is nothing else than a test");

  mail.html_body("<p>This is nothing else than a <b>test</b></p>");

  mail.attach("%TRACE%/error.lst"); // send odaba error protokol

  mail.send("admin@my_server.com","secrete_pwd");

  mail.close(); // release resources

}

Attributes
    Functions