RE: mail with attachments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi hari,
   
  thanks to send the code to me.thanks a lot.

Hari <hariharan.83@xxxxxxxxx> wrote:
          Hi kalaiselvi,

Here with I have given the coding for sending mail with attachment.

<?php 

$to ='to address';

$subject ='subject';

$headers = "From: from mail \r\n";

$headers.="Reply-To: from mail \r\n";

$headers .="Bcc: bcc mail address \r\n";

$date=date();

$HTML="content";//mail content to be sent

$body = chunk_split(base64_encode($HTML));

$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}\" ";

$body .= "This is a multi-part message in MIME format. \n\n" .

"--{$mime_boundary} \n" .

"Content-Type:text/html; charset=\"UTF-8\" \n" .

"Content-Transfer-Encoding: base64 \n\n" .

$body . "\n\n";

// Read the file to be attached ('rb' = read binary)

//$newname is file to be attached

$file = fopen($newname,'r');

$data = fread($file,filesize($newname));

fclose($file);

$data = chunk_split(base64_encode($data));

$body .= "--{$mime_boundary}\n" .

"Content-Type: {$fileatt_type}; \n" .

" name=\"{$fileatt_name}\"\n" .

"Content-Transfer-Encoding: base64 \n\n" .

$data . "\n\n" .

"--{$mime_boundary}--\n"; 

// Add the headers for a file attachment 

$mail_sent = @mail($to,$subject,$body,$headers);

?>

With regards,

R.Hari

_____ 

From: php-objects@xxxxxxxxxxxxxxx [mailto:php-objects@xxxxxxxxxxxxxxx] On
Behalf Of kalai selvi
Sent: Wednesday, July 18, 2007 10:16 AM
To: php-objects@xxxxxxxxxxxxxxx
Subject:  mail with attachments

hi all,

i need help,HOW TO SEND AN ATTACHMENTS(its like .doc format) WITH MAIL
FUNCTION USING PHP SCRIPT,plz if any body tell me the script for my
question.

thanks in advance

Reagrds,

Kalaiselvi Ranganathan

---------------------------------
Need a vacation? Get great deals to amazing places on Yahoo! Travel. 

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]



         


Reagrds,


Kalaiselvi Ranganathan
       
---------------------------------
Yahoo! oneSearch: Finally,  mobile search that gives answers, not web links. 

[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux