Skip to content

Instantly share code, notes, and snippets.

@zlojkashtan
Forked from manviny/processwireMail
Created April 26, 2014 16:17
Show Gist options
  • Save zlojkashtan/11324156 to your computer and use it in GitHub Desktop.
Save zlojkashtan/11324156 to your computer and use it in GitHub Desktop.
<?php
$start = $input->get->$from;
$start = $input->get->$from_name;
$start = $input->get->$to;
$start = $input->get->$to_name;
$subject = $input->get->subject;
$start = $input->get-> $message;
email_classic($from, $from_name, $to, $to_name, $subject, $message);
// classic way
function email_classic($from, $from_name, $to, $to_name, $subject, $message){
$from = htmlentities($from_name."<".$from.">");
$headers = "From: {$from}\n";
$headers .= "Reply-To: {$from}\n";
// $headers .= "Cc: {$to}\n";
// $headers .= "Bcc: {$to}\n";
$headers .= "X-Mailer: PHP/".phpversion()."\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/plain; charset=iso-8859-1";
$result = mail($to, $subject, $message, $headers);
echo $result ? 'Message sent!' : 'Mailer Error';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment