public function sendMail($email, $subject, $msg = NULL) { global $websiteName, $emailAddress; $header = array('From' => 'INNOVAPATH <' . $emailAddress . '>\\r\\n', 'Reply-to' => 'INNOVAPATH <' . $emailAddress . '>\\r\\n'); //Check to see if we sending a template email. if ($msg == NULL) { $msg = $this->contents; } $message = $msg; $message = wordwrap($message, 70); $mail_body = array('text/html' => $message); return PostageApp::mail($email, $subject, $mail_body, $header); }
<?php require_once 'postageapp_class.inc'; $to = '*****@*****.**'; // The subject of the message $subject = 'Postage App test email'; // Setup some headers $header = array('From' => '*****@*****.**', 'Reply-to' => '*****@*****.**'); // The body of the message $mail_body = array('text/plain' => 'Hello world in plain text', 'text/html' => '<h1>Hello world</h1><p>in <b>HTML</b></p>'); // Send it all $ret = PostageApp::mail($to, $subject, $mail_body, $header); // Checkout the response if ($ret->response->status == 'ok') { echo '<br/><b>SUCCESS:</b>, An email was sent and the following response was received:'; } else { echo '<br/><b>Error sending your email:</b> ' . $ret->response->message; } echo '<pre style="text-align:left;">'; print_r($ret); echo '</pre>';