====== PHP: Envoyer un mail ====== Vous aurez besoin de XPM4-v.0.5.zip (voir section download) Test Email leo-stitch". "Ceci est un document HTML
" . "Avec differentes tailles de caractères et couleurs" ; $host = "ssl://relay.mail.gandi.net"; $port = "465"; $username = "football@domain.com"; $password = "unix au buro"; $smtp_host='relay.mail.gandi.net'; // connect to MTA server (relay) 'smtp.hostname.tld' via SSL (TLS encryption) with authentication using port '465' and timeout '10' secounds // make sure you have OpenSSL module (extension) enable on your php configuration //$smtp = SMTP::connect($smtp_host, 465, $username, $password, 'https', 10); /*$smtp = SMTP::connect($smtp_host, 25, $username, $password);*/ // CONFIGURATION ------------------ $smtp = SMTP::connect($smtp_host, 25, $username, $password); // print result if ($smtp) echo 'Successfully connected !'; else print_r($_RESULT); // <- for debugging // set text/plain version of message $msg1 = MIME::message($text, 'text/plain'); // set text/html version of message $msg2 = MIME::message($html, 'text/html'); $file = "sanmailWithMime.php"; $at[] = MIME::message(file_get_contents($file), 'text/plain', 'sanmailWithMime.php', 'ISO-8859-1', 'base64', 'attachment'); $file = 'Leo_et_Stitch.jpg'; // add inline attachment '$file' with name 'XPM.gif' and ID '$id' $at[] = MIME::message(file_get_contents($file), FUNC::mime_type($file), $file, // Nom du fichier dans l'attachement null, 'base64', 'attachment'); $at[] = MIME::message(file_get_contents($file), FUNC::mime_type($file), $file, // Nom du fichier dans l'attachement null, 'base64', 'inline', $id ); // compose message in MIME format $mess = MIME::compose($msg1, $msg2, $at); // standard mail message RFC2822 $body = 'From: '.$from."\r\n". 'To: '.$to."\r\n". 'Subject: '.$subject."\r\n". $mess['header']."\r\n\r\n". $mess['content']; print $body; $sent = SMTP::send($smtp, array($to), $body, $from); if ($sent) echo 'Sent !'; else print_r($_RESULT); /* // send mail relay using '$c' resource connection if ($m->Send($smtp)) { echo("

Message successfully sent!

"); } else { echo("

error

"); } */ ?>