<?php

// send text/plain and text/html multiple e-mail messages (multipart/alternative)
// send to multiple e-mail addresses (Cc and Bcc)
// attach an embed HTML image (inline) and file (attachment)
// using a relay smtp server with authentication and TLS (SSL) connection
// notice: make sure you have OpenSSL module (extension) enable on your PHP configuration in order to use TLS/SSL connection

// E_ALL -> debugging
// false -> public
error_reporting(E_ALL);
// 0 -> no time limit
set_time_limit(0);

// path to smtp.php from XPM2 package
require_once '../../smtp.php';

$mail = new SMTP;
$mail->Delivery('relay');
$mail->Relay('relay-hostname.net', 'username', 'password', 465, 'autodetect', 'tls');
$mail->TimeOut(10);
$mail->Priority('high');
$mail->From('username@relay-hostname.net', 'my name');
$mail->AddTo('client@destination.com', 'user name');
$mail->AddCc('another@domain.com', 'another user');
$mail->AddBcc('hidden@host.com');
$mail->Text('Text version of the message');
$mail->Html('<font color="red"><b><u>HTML version of the message</u></b></font><br><br><i>Powered by</i> <img src="photo.gif">');
$mail->AttachFile('image.gif', 'photo.gif', 'autodetect', 'inline');
$mail->AttachFile('file.zip');
$sent = $mail->Send('Hello World!');

echo $sent ? 'Success' : 'Error';

// for debugging
echo '<br>Result: '.$mail->result;

?>