|
|
| |
1. big message to gmail |
|
Reply |
|
|
 sergiy serov | 2008-12-24 16:56:20 |
Could somebody please help me with this attachments code, as it doesn't send to gmail big messages (>500KB):
$email_to = "somebody@gmail.com"; // Who the email is to
$headers = "From: ".$name_from." <".$email_from.">"."\r\n";
$headers .= "Reply-To: ".$name_from." <".$email_from.">"."\r\n";
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$semi_rand2 = md5(time());
$mime_boundary2 = "==Multipart_Boundary_x{$semi_rand2}x";
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
$email_message .= "--{$mime_boundary}\n";
$email_message .= "Content-Type:text/plain; charset=UTF-8\n";
$email_message .= "Content-Transfer-Encoding: 7bit\n\n";
$email_message .= $email_txt ."\n";
if ($files != ""){
$fileatt_type = "application/octet-stream"; // File Type
$files_array = explode(",",$files);
$no_files = count($files_array)-1;
for ($a = 0; $a <$no_files; $a++) {
$fileatt = "files/".$files_array[$a]; // Path to the file
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);
$data = chunk_split(base64_encode($data));
$email_message .= "--{$mime_boundary2}\n";
$email_message .= "Content-Type: {$fileatt_type}; name=\"{$files_array[$a]}\"\n";
$email_message .= "Content-Disposition: attachment; filename=\"{$files_array[$a]}\"\n";
$email_message .= "Content-Transfer-Encoding: base64\n\n";
$email_message .= $data . "\n\n";
}};
$email_message .="--{$mime_boundary}--\n";
$ok = @mail($email_to, $email_subject, $email_message, $headers);
if ($files != ""){for ($a = 0; $a <$no_files; $a++) {unlink("files/".$files_array[$a]);};};
|
There are 3 replies in this thread, which are not being displayed. Browsing this forum thread replies is available only to premium subscribers.
Go to the premium subscriptions page to learn how to become a premium subscriber and have full access to this forum. |