I have php built that sends an attachment. When it sends, it takes forever and I finally get this:
Fatal error: Maximum execution time of 30 seconds exceeded in C:\Inetpub\wwwroot\web\sendmixed.php on line 42
After I get this, I get the email with the attachment (but when I open the attachment, it is blank) but it takes forever to send. Whats wrong with this?
<?php
#open the file
$fp = fopen( $att_name, "r");
#read the file into a variable
$file = fread( $fp, $att_size );
#encode the data for safe transit
#and insert \r\n every 76-characters
$file = chunk_split(base64_encode($file));
#get a random 32-character hexadecimal number
$num = md5( time() );
#define the main headers
$hdr = "From:$from\r\n";
$hdr .= "Mime-Version: 1.0\r\n";
$hdr .= "Content-Type: multipart/mixed; ";
$hdr .= "boundary=$num\r\n";
$hdr .= "--$num\r\n";
#define the message section
$hdr .= "Content-Type: text/plain\r\n";
$hdr .= "Content-Transfer-Encoding: 8bit\r\n\n";
$hdr .= "$comments\r\n";
$hdr .= "--$num\n";
#define the attachment section
$hdr .= "Content-Type: $att_type; ";
$hdr .= "name=\"$att_name\"\r\n";
$hdr .= "Content-Transfer-Encoding: bas64\r\n";
$hdr .= "Content-Disposition: attachment; ";
$hdr .= "filename=\"$att_name\"\r\n\n";
$hdr .= "$file\r\n";
$hdr .= "--$num--";
#send the email now
mail( $to, $re, "", $hdr);
#close the file
fclose($file);
?>