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
}
- Email - Constructor
- attach - Attach file to email
- attachment - Get attachment from email
- attachmentCount - Get number of attachments in Email
- binaryBody - Binary email body
- body - Plain message text
- close - Close email handle
- command - Submit POP command to POP server
- fileName - Email content attribute file name
- getMail - Receive email from server and analyze
- headerAttribute - Header attribute
- host - Email host
- htmlBody - HTML message
- isValid - Checks whether the Email instance is valid
- mailCount - Get number of emails on server
- message - Email message
- open - Open email handle
- popLogin - Login to POP mail server
- popLogout - Logout from pop server
- port - Port number
- receiver - Receiver's email address
- receiverName - Set receiver's display name
- response - Get response for last command
- send - Send email
- sender - Sender's email address
- senderName - Set sender's display name
- subject - Email subject
- ~Email - - Title unknown