Skip to content

Instantly share code, notes, and snippets.

@mauromarano
Created November 11, 2012 12:19
Show Gist options
  • Save mauromarano/4054750 to your computer and use it in GitHub Desktop.
Save mauromarano/4054750 to your computer and use it in GitHub Desktop.
Function to send email (in html) with php
function email2($to, $title, $text, $from_email, $from_name ){
// costruiamo alcune intestazioni generali
$header = "From: ".$from_name." <".$from_email.">\n";
$header .= "X-Mailer: Il nostro Php\n";
// costruiamo le intestazioni specifiche per il formato HTML
$header .= "MIME-Version: 1.0\n";
$header .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
$header .= "Content-Transfer-Encoding: 7bit\n\n";
// inviamo il messaggio di posta elettronica
// controllando eventuali errori
return @mail($to, $title, $text, $header);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment