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 is not supported or when using port 25, emails are sent using POP before SMPT. When cURL is supported, encrypted emails can be sent using SSL including certificate verification for host and client.

// osi fragment

bool static sendMail () {

VARIABLES

  Email         mail;

PROCESS

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

  mail.host("my_server.com");

  mail.port(25);

  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