Oops, sent this previous mail to Manuel instead of the group... :)
Hi All!
Sure, here is what I've:
<?php
$uploaddir='/tmp/';
$account_file = "account.txt"; //Substitute with a valid file on ur system
$account_file = $uploaddir.basename($account_file);
$file = fopen($account_file,'rb');
$data = fread($file,filesize($account_file));
fclose($file);
// echo $data;
$to = " [EMAIL PROTECTED]";
$from = "[EMAIL PROTECTED]";
$message = "Hi! Where are you these days?";
$headers = "From: $from";
// Generate a boundary string
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
// Add the headers for a file attachment
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
// Add a multipart boundary above the plain message
$message = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$message . "\n\n";
// Base64 encode the file data
$data = chunk_split(base64_encode($data));
$fileatt_type="text/plain";
$fileatt_name="Hola";
// Add file attachment to the message
$message .= "--{$mime_boundary}\n" .
"Content-Type: {$fileatt_type};\n" .
" name=\"{$fileatt_name}\"\n" .
"Content-Disposition: attachment;\n" .
" filename=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
// echo $message;
// Send the message
$ok = @mail($to, $subject, $message, $headers);
if ($ok) {
echo "<p>Mail sent Successfully</p>";
} else {
echo "<p>Mail send failed</p>";
}
?>
Thanks & Regards
KM
On 6/19/06, Manuel Lemos <[EMAIL PROTECTED]> wrote:
on 06/18/2006 12:29 PM kartikay malhotra said the following:
> I've use PHP mail to send mail to my Gmail ID. But it gets delivered to
my
> Spam box and not the Inbox :(
>
> Am I missing a header, signature, certificate?
Maybe if you show how you are composing the message you are sending we
can advise.
--
Regards,
Manuel Lemos
Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP General Mailing List ( http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php