par Fesch » 07 Déc 2003 11:48
Voilà:
<BR>
<BR>// $to = ARRAY !!
<BR>// $header = ARRAY !!
<BR> function sendmail($from,$to,$cc,$bcc,$subject,$header,$body,$server)
<BR> {
<BR> $smtp=fsockopen ($server, 25, $errno, $errstr, 30 );
<BR> if (!$smtp)
<BR> {
<BR> echo "$errno - $errstr";
<BR> return $errno;
<BR> }
<BR> else
<BR> {
<BR> fputs ($smtp,"HELO sendmailrn" ); flush();
<BR> fgets($smtp,1024)."<br>"; flush();
<BR> fputs ($smtp,"MAIL FROM: <$from>rn" ); flush();
<BR> fgets($smtp,1024)."<br>"; flush();
<BR> foreach($to as $t)
<BR> {
<BR> fputs ($smtp,"RCPT TO: <$t>rn" ); flush();
<BR> fgets($smtp,1024)."<br>"; flush();
<BR> }
<BR> fputs ($smtp,"DATArn"); flush();
<BR> fgets($smtp,1024)."<br>"; flush();
<BR> fputs ($smtp,"Subject: $subjectrn" ); flush();
<BR> fputs ($smtp,"Cc: $ccrn" ); flush();
<BR> fputs ($smtp,"Bcc: $bccrn" ); flush();
<BR> foreach($header as $h)
<BR> {
<BR> fputs ($smtp,"$hrn" ); flush();
<BR> }
<BR> fputs ($smtp,"rn" ); flush();
<BR> fputs ($smtp,"$bodyrn" ); flush();
<BR> fputs ($smtp,".rn" ); flush();
<BR> fgets($smtp,1024)."<br>"; flush();
<BR> fputs ($smtp,"QUIT" ); flush();
<BR> fgets($smtp,1024)."<br>"; flush();
<BR> return 0;
<BR> }
<BR> }
<BR>
Pourquoi lis-tu ceci???