Home arrow Calculatoare arrow Send mail cu PHP

Reclama


Send mail cu PHP PDF Print E-mail
User Rating: / 1
PoorBest 
Written by Administrator   
Sunday, 24 June 2007

<?
$message="Test";

$headers = "From: This email address is being protected from spam bots, you need Javascript enabled to view it   \n";

$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";

$headers .= "MIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";


// Add a multipart boundary above the  message
$message = "This is a multi-part message in MIME format.


\n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/html; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$message . "\n\n";
foreach($_FILES as $name=>$v)
{
       
    if(filesize($_FILES[$name]["tmp_name"])>0)
    {
       
        $file = fopen($_FILES[$name]["tmp_name"],'rb');

        $data = fread($file,filesize($_FILES[$name]["tmp_name"]));

        fclose($file);

        // Base64 encode the file data
        $data = chunk_split(base64_encode($data));       
       
        $semi_rand = md5(time());

        $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
       
        $message.="--{$mime_boundary}\n" .
        "Content-Type: ".$_FILES["image$i"]["type"].";\n" .       
        "Content-Transfer-Encoding: base64\n".
        "Content-Disposition: attachment; filename=\"".$_FILES[$name]['name']."\"\n\n" .
        $data . "\n\n";           
    }   
}

mail(" This email address is being protected from spam bots, you need Javascript enabled to view it ","Hello",$message,$headers); 
?>
 
< Prev

Search

Noutati

Pentru cei din Iasi, vizitati hubul dc.e-iasi.com, special dedicat anuturilor(Vanzari&Cumparari)
 

Login






Lost Password?
No account yet? Register

Informatii

Cine e online