PAlarm Class Reference

Detailed Description

The PAlarm class is a toolbox to send alarms (text, images) by email.

Definition at line 25 of file PAlarm.h.

#include <PAlarm.h>

Member Function Documentation

◆ SendEmail()

static PResult PAlarm::SendEmail ( const PString smtpURL,
const PString username,
const PString password,
const PString from,
const PString to,
const PString content 
)
static

Sends an email.

WARNING: to make it works, curl (binary program, see https://curl.haxx.se/) must be available in the environment, at runtime.

Returns PResult::C_OK if success, another result otherwise.

Example:

smtpURL = "smtp://smtp.gmail.com:587"
username = "john.doe@gmail.com"
password = "myPassword"
from = "jane.doe\@gmail.com"
to = "destination\@gmail.com"
content = "From: "John Doe" <john.doe\@gmail.com>
To: "Jane Doe" <jane.doe\@gmailcom>
Subject: This is a test
Hi Jane,
I'm sending this mail with my gmail account.
Bye!
"

For Demos, you could use MailGun web service (https://www.mailgun.com/) which is really simple to use.