Ignore:
Timestamp:
Jul 30, 2006, 6:14:15 PM (14 years ago)
Author:
booz@…
Message:

exemple d'email evoye par smtp

File:
1 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/_email_/phpmailer/phpmailer.html

    r4293 r4294  
    11<?php
     2
     3// Ce squelette permet de tester le code sur son hebergeur
    24
    35include_spip('class.phpmailer');
     
    1113$mail->port=25;
    1214$mail->From='booz@machin.com';
    13 $mail->AddAddress('booz@rezo.net');
     15$mail->AddAddress('booz@machin.net');
    1416$mail->AddReplyTo('booz@machin.net');   
    1517$mail->Subject='ceci n\'est pas un test';
    16 $mail->Body='Voici un exemple d\'e-mail au format Texte';
    1718$mail->SMTPAuth = true;
    1819$mail->Username = "booz@machin.com";
    1920$mail->Password = "toto";
    2021$mail->AddStringAttachment("IMG/auton4.jpg", "Logo.jpg");
     22
     23// HTML body
     24    $body  = "Hello <font size=\"4\">BoOz</font>, <p>";
     25    $body .= "<i>Your</i> personal photograph to this message.<p>";
     26    $body .= "Sincerely, <br>";
     27    $body .= "PHPMailer List manager";
     28
     29    // Plain text body (for mail clients that cannot read HTML)
     30    $text_body  = "Hello, \n\n";
     31    $text_body .= "Your personal photograph to this message.\n\n";
     32    $text_body .= "Sincerely, \n";
     33    $text_body .= "PHPMailer List manager";
     34
     35    $mail->Body    = $body;
     36    $mail->AltBody = $text_body;
     37    $mail->AddAddress("cedric@bidule.com","Cedribox");
     38    $mail->AddStringAttachment("IMG/siteon0", "YourPhoto.jpg");
     39
    2140
    2241if(!$mail->Send()){ //Teste le return code de la fonction
     
    2645  echo 'Mail envoye avec succes';
    2746}
     47
    2848$mail->SmtpClose();
     49// Clear all addresses and attachments for next loop
     50$mail->ClearAddresses();
     51$mail->ClearAttachments();
    2952unset($mail);
    3053
     
    3255#$mail->Mailer   = "mail";
    3356
     57//envoi format html seul
     58#$mail->IsHTML();
     59//envoi format texte seul
     60#$mail->IsTEXT();
     61
    3462?>
Note: See TracChangeset for help on using the changeset viewer.