Exemplo n.º 1
0
 } else {
     // We say that we have uploaded the file
     $up = 1;
     $file_up = 0;
 }
 // We check we have uploaded the file
 if ($up && $no_empty_champs) {
     // We include the SMTP class
     include './Class.SMTP.php';
     // We define the parametres of the SMTP connection
     $smtp = new SMTP($smtp_serveur, $smtp_login, $smtp_passe, 25, $smtp_domain);
     // We int the sender
     $smtp->set_from($_POST['name'], $_POST['email']);
     if ($file_up) {
         // Attach file
         $smtp->add_file($file_up);
     }
     // We define the Content type ( Value can be: html (for html), txt (for text), txt/html (for text and html) )
     $smtp->ContentType = 'txt';
     // We send the mail
     $smtp->smtp_mail($mail_to, $_POST['sujet'], $_POST['msg']);
     // We check that the mail as been send
     if (!$smtp->erreur) {
         echo '<div style="text-align:center; color:#008000;">Your mail as been send.</div>', "\r\n";
         if ($file_up) {
             // Delete tempory file
             unlink($file_up);
         }
     } else {
         // Print error(s)
         echo $smtp->erreur;
*       Version envoie simple avec une pièce jointe.php
* Auteur :
*       Nuel Guillaume alias Immortal-PC
* Site Web :
*       http://immortal-pc.info/
*
*******************************************************************************/
include './Class.SMTP.php';
$smtp = new SMTP('smtp.serveur.fr', 'login', 'pass', 25, 'immortal-pc.info');
$smtp2 = new SMTP('smtp.serveur_2.fr', 'login', 'pass', 25, 'immortal-pc.info');
$smtp->set_from('Immortal-PC', '*****@*****.**', 'Site web Immortal-PC');
$smtp2->set_from('Immortal-PC', '*****@*****.**', 'Site web Immortal-PC');
// Ajout des fichiers
$smtp->add_file('./Fichier_test.gif');
$smtp->add_file('./Fichier_test.txt');
$smtp2->add_file('./Fichier_test.gif');
$smtp2->add_file('./Fichier_test.txt');
$To = '*****@*****.**';
// A QUI
$Sujet = 'Sujet';
// Sujet
$msg = 'Votre message ici' . "\r\n" . 'ça marche !!';
$smtp->smtp_mail($To, $Sujet, $msg);
// Envoie du mail ( Serveur 1 )
$smtp2->smtp_mail($To, $Sujet, $msg);
// Envoie du mail ( Serveur 2 )
if (!$smtp->erreur) {
    echo '<div style="text-align:center; color:#008000;">Votre mail a bien été envoyé. (Serveur 1)</div>', "\r\n";
} else {
    // Affichage des erreurs
    echo '<div style="color:#FF0000;">Serveur 1 : ', $smtp->erreur, '</div>', "\r\n", '<br />', "\r\n";