Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

php mail with multiple attachment

General discussions related to php

Moderators: macek, egami, gesf

php mail with multiple attachment

Postby jaty131313 » Wed Dec 26, 2012 12:16 pm

Hi i wanna code for php mail with multiple attachments with one email message, some one plz help me with tested codes, its urgent..... thanks in advance....
jaty131313
New php-forum User
New php-forum User
 
Posts: 2
Joined: Wed Dec 26, 2012 10:29 am

Re: php mail with multiple attachment

Postby jaty131313 » Sat Dec 29, 2012 7:29 am

no one knows ???
jaty131313
New php-forum User
New php-forum User
 
Posts: 2
Joined: Wed Dec 26, 2012 10:29 am

Re: php mail with multiple attachment

Postby Jakal » Sat Dec 29, 2012 7:41 am

Jakal
New php-forum User
New php-forum User
 
Posts: 1
Joined: Sat Dec 29, 2012 7:21 am

Re: php mail with multiple attachment

Postby PreetiGarg » Mon Dec 31, 2012 12:14 am

<?php
function mail_attachment($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message) {
$file = $path.$filename;
$file_size = filesize($file);
$handle = fopen($file, "r");
$content = fread($handle, $file_size);
fclose($handle);
$content = chunk_split(base64_encode($content));
$uid = md5(uniqid(time()));
$name = basename($file);
$header = "From: ".$from_name." <".$from_mail.">\r\n";
$header .= "Reply-To: ".$replyto."\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
$header .= "This is a multi-part message in MIME format.\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-type:text/plain; charset=iso-8859-1\r\n";
$header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$header .= $message."\r\n\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-Type: application/octet-stream; name=\"".$filename."\"\r\n"; // use different content types here
$header .= "Content-Transfer-Encoding: base64\r\n";
$header .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n";
$header .= $content."\r\n\r\n";
$header .= "--".$uid."--";
if (mail($mailto, $subject, "", $header)) {
echo "mail send ... OK"; // or use booleans here
} else {
echo "mail send ... ERROR!";
}
}
?>
User avatar
PreetiGarg
New php-forum User
New php-forum User
 
Posts: 14
Joined: Fri Dec 28, 2012 2:27 am


Return to PHP General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.