Mini Shell
<?php
/**
* Mailer
*
* @author Andrew Esteves <andrew@digitalnativa.com.br>
* @copyright Digital Nativa (www.digitalnativa.com.br)
*/
class Mailer
{
/**
* To a person (receiver)
* @var String
* @access private
*/
private $to;
/**
* Subject of the e-mail
* @var String
* @access private
*/
private $subject;
/**
* Frrom (sender)
* @var String
* @access private
*/
private $from;
/**
* Message
* @var String
* @access private
*/
private $message;
/**
* Headers
* @var Array
* @access private
*/
private $headers;
/**
* Initiate the mail class
*
* @param String $to
* @param String $subject
* @param String $from
* @param Array $message
*/
public function __construct($to, $subject, $from, $message)
{
$this->to = $to;
$this->subject = $subject;
$this->from = $from;
$this->message = $message;
}
/**
* Send mail
*
*/
public function send()
{
$body = '<h3>Emypro Web</h3>';
$body .= '<h6>Formulário de contato.</h6>';
$body .= '<p>Nome: '. $this->message['name'] .'</p>';
$body .= '<p>E-mail: '. $this->message['email'] .'</p>';
$body .= '<p>Telefone: '. $this->message['phone'] .'</p>';
$body .= '<p>Mensagem: '. $this->message['message'] .'</p><br>';
$body .= '<p style="font-size: 11px;"><i>Enviado por <a href="http://www.digitalnativa.com.br">Digital Nativa</a></i></p>';
$this->headers[] = 'From: '. $this->from;
$this->headers[] = 'Reply-To: ' .$this->from;
$this->headers[] = 'Content-Type: text/html; charset=UTF-8';
$this->headers[] = 'MIME-Version: 1.0';
$this->headers[] = 'X-Priority: 1 (Higuest)';
$this->headers[] = 'X-MSMail-Priority: High';
$this->headers[] = 'Importance: High';
if(function_exists('mail')) {
return mail($this->to, $this->subject, $body, implode("\n", $this->headers));
}else{
throw new Exception("Please enable the PHP mail function on your server");
}
}
}
Zerion Mini Shell 1.0