I have found the following code for sending html email with attachment .
This code is working fi9 but it is not showing message text "hello" defined in $email_txt
PHP Code:
<?
if($_FILES["fileatt"] != NULL)
{
$fileatt_type = "application/octet-stream"; //File Type
$email_from = "baber@inbox.com"; // Who the email is from
$email_subject = "Test File Attach"; // The Subjectof the email
$email_txt = "hello"; // Message that the email has in it
$email_to = "baberzubair@gmail.com"; // Who the email is too
if($ok)
{
echo "<font face=verdana size=2>The file was
successfully sent!</font>";
}else{
die("Sorry but the email could not be sent.
Please go back and try again!");
}
}
?>
so if u have solution for this problem plz tell me.
Last edited by Nico; 11-28-06 at 12:38 PM.
Reason: Please use [php] wrappers when posting PHP code.
that's because you enter the mail_txt outside the mail boundaries. You should first assign the $email_txt to $email_message before closing the boundary "--{$mime_bounday}--\n"
I would recommend you to use phpmailer or another class. These allow you to send multipart messages easily.
UnrealEd
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks
I tried assigning the email_txt before closing the boudries but it doesnot work.so you plz copy whole of code and then rewrite after making nessesary changes so i will copy the whole code.
<?
if($_FILES["fileatt"] != NULL)
{
$fileatt_type = "application/octet-stream"; //File Type
$email_from = "baber@inbox.com"; // Who the email is from
$email_subject = "Test File Attach"; // The Subjectof the email
$email_txt = "hello"; // Message that the email has in it
$email_to = "baberzubair@gmail.com"; // Who the email is too
if($ok)
{
echo "<font face=verdana size=2>The file was
successfully sent!</font>";
}else{
die("Sorry but the email could not be sent.
Please go back and try again!");
}
}
?>
I think this should do it. But once again, i think it's better to use existing classes to creata multipart messages. phpmailer is one of them
UnrealEd
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks