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
}
- Email - Constructor
- attach - Attach file to email
- body - Plain message text
- close - Close email handle
- host - Email host
- html_body - HTML message
- isValid - Checks whether the Email instance is valid
- open - Open email handle
- port - Port number
- receiver - Receiver's email address
- receiverName - Set receiver's display name
- send - Send email
- sender - Sender's email address
- senderName - Set sender's display name
- subject - Email subject
- ~Email - - Title unknown