Voici ma ligne 75 :
$mail-> SetFrom =("[email protected]<script type="text/javascript">
et voici mon code complet qui est placé dans le répertoire phpmailer :
mon but est de pouvoir envoyer, je dispose de wamp + BDD avec email, mais je ne sais pas faire ?? merci de votre aide. Vraiment je recherche qq chose de vraiment simple svp
info (je dispose que d'une adresse mail gmail, est du code ci-dessous, manque t-il des choses si oui lesquelles et comment faire pour faire marcher cette mécanique qui m 'a l air compliquer merci les experts de votre aide)
<?php
require_once('phpmailer/class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
try {
$mail->Host = ("smtp.sfr.fr");
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPKeepAlive = true; // SMTP connection will not close after each email sent
$mail->Port = 5027; // set the SMTP port for the GMAIL server
$mail->Username = ("smtp%xxx.fr"); // SMTP account username
$mail->Password = ("xxx"); // SMTP account password
} catch (phpmailerException $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
}
$user = "xxx";
$password = "xxx";
$database = "xxxx";
$host = "xxx";
$connect = mysql_connect($host, $user, $password) or die(mysql_error());
mysql_select_db($database);
$forcli = $Cookcli;
$result = mysql_query ("select * from client where codecli = '$forcli'");
$row = mysql_fetch_object($result);
echo "<FONT SIZE=+3>";
echo "<DIV ALIGN=center><FONT COLOR=\"#0000CC\"><B>$forcli $row->nom</B></FONT></DIV>";
echo "</FONT>";
echo "<HR SIZE=3 NOSHADE>";
$forcli = $Cookcli;
$fornom = $Cooknom;
if ($forcli < 1)
{echo "<B><FONT SIZE=+1>Votre session est terminée, vous devez vous identifier à nouveau...</FONT></B>";}
$fordate = gmdate("Y-m-d");
$nb = 1;
if ($forcli < 1) {$nb = 0;}
$result = mysql_query("select * from bordereau left join dossier on dossier.numdos = bordereau.numdos where bordereau.numbor = '$numbor' and bordereau.etat = 1
order by bordereau.numbor, bordereau.numdos ");
$nb2 = 0;
if ($result) {$nb2 = mysql_num_rows($result);}
if ($nb2 == 0) {$nb = 0;}
if ($nb > 0)
{while ($row = mysql_fetch_object($result))
{
$si = " numbor = $row->numbor and numdos = $row->numdos ";
$majbor = mysql_query
("update bordereau set etat = 2 where ".$si);
$mesbor .= "$forcli $row->typetrans $fornom;$row->numdos;";
$mesbor .= "$row->reference;$row->nom;$row->adresse1;$row->adresse2;";
$mesbor .= "$row->codepostal;$row->ville;$row->codepays;";
$mesbor .= "$row->nbcolis;$row->poids;$row->volume;$row->metreplancher;";
$mesbor .= "$row->portdu;$row->cr;$row->crdevise;";
$mesbor .= "$row->cr2;$row->crdev2;";
$mesbor .= "$row->vd;$row->vddevise;$row->commentaire;";
$mesbor .= "$row->express;$row->hayon;$row->teldesti;";
$mesbor .= "$row->nbpalettes;$row->obspalette;\n";
}
;}
$mesbor = strtoupper($mesbor);
$ligne1 = "<br>";
$ligne2 = "<br>le bordereau numéro <B>$numbor</B> est transmis";
if ($nb > 0) {
echo "$ligne1 $ligne2";
try {
$mail-> SetFrom =("[email protected]<script type="text/javascript">
/* <![CDATA[ */
(function(){try{var s,a,i,j,r,c,l,b=document.getElementsByTagName("script");l=b[b.length-1].previousSibling;a=l.getAttribute('data-cfemail');if(a){s='';r=parseInt(a.substr(0,2),16);for(j=2;a.length-j;j+=2){c=parseInt(a.substr(j,2),16)^r;s+=String.fromCharCode(c);}s=document.createTextNode(s);l.parentNode.replaceChild(s,l);}}catch(e){}})();
/* ]]> */
</script>");
$mail-> AddReplyTo =("[email protected]<script type="text/javascript">
/* <![CDATA[ */
(function(){try{var s,a,i,j,r,c,l,b=document.getElementsByTagName("script");l=b[b.length-1].previousSibling;a=l.getAttribute('data-cfemail');if(a){s='';r=parseInt(a.substr(0,2),16);for(j=2;a.length-j;j+=2){c=parseInt(a.substr(j,2),16)^r;s+=String.fromCharCode(c);}s=document.createTextNode(s);l.parentNode.replaceChild(s,l);}}catch(e){}})();
/* ]]> */
</script>;");
$mail-> Subject = ("Bordereau de chargement N $numbor");
$mail-> message = ("$mesbor");
$mail-> AddAdress = ('[email protected]<script type="text/javascript">
/* <![CDATA[ */
(function(){try{var s,a,i,j,r,c,l,b=document.getElementsByTagName("script");l=b[b.length-1].previousSibling;a=l.getAttribute('data-cfemail');if(a){s='';r=parseInt(a.substr(0,2),16);for(j=2;a.length-j;j+=2){c=parseInt(a.substr(j,2),16)^r;s+=String.fromCharCode(c);}s=document.createTextNode(s);l.parentNode.replaceChild(s,l);}}catch(e){}})();
/* ]]> */
</script>');
$mail-> AltBody = $mesbor;
$mail->AddAttachment("BO$numbor.txt");
$mail->Send();
} catch (phpmailerException $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
}
}
if ($nb >0)
{echo "<BR><BR><DIV ALIGN=\"center\">
<A HREF=\"borimp.php? numbor=$numbor\" TARGET=_blank>Imprimer le bordereau</A>
<A HREF=\"bordefinitif.php\" TARGET=_self>Retour</A>
</DIV>" ;}
?>
Voici aussi le code 2 que je n 'arrive pas à faire fonctionner...
message d erreur :
Avertissement : require_once (class.phpmailer.php) [ function.require-once ]: failed to open stream: No such file or directory dans C: \ wamp \ www \ mail9-PHPMailer \ test-03_simple.php sur la ligne 7
Fatal error : require_once () [ function.mysql ]: ('.; C: \ php5 \ pear' include_path =) Failed opening required 'class.phpmailer.php »dans C: \ wamp \ www \ mail9-PHPMailer \ test-03_simple. php on line 7
<?php
/*
envoie d'email par authentification smtp avec la lib phpmail
*/
require_once 'class.phpmailer.php'; //le fichier class.phpmailer.php est dans le même répertoire que le script courant
$mail = new PHPMailer();
$mail->IsHTML(true);
$mail->CharSet = "utf-8";
$mail->SMTPDebug = 2;
$body = "<p> corps du mail.ceci est un texte bidon.............</p>";
$mail->IsSMTP();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port
$mail->Username = "[email protected]"; // ton compte gmail
$mail->Password = "tonMotDePasse"; // ton mot de passe gmail
$mail->From = "[email protected]";//"[email protected]";
$mail->FromName = "yann";
$mail->Subject = "Titre de ton message";
//$mail->AltBody = "This is the body when user views in plain text format"; //Text Body
$mail->WordWrap = 50; // set word wrap
$mail->MsgHTML($body);
$mail->AddReplyTo("[email protected]","Toto titi");
$mail->AddAddress("[email protected]","miss"); //!!!!adresse mail du destinataire
$mail->IsHTML(true); // send as HTML
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message envoyé avec succès";
}
?>