how to mail attachment in php not sure?
i had a look on how to do this but it looks too complicated. all i want is to mail a small .txt as an attachment can anyone help please? i have this code:
$to = "a mail adress";
$file = "/home/rainbowcode/StatsFile.txt";
$subject = "StatsFile.开发者_StackOverflowtxt";
$email = "a mail adress";
$message = "Here is your Statsfile; for today";
$headers = "From: $email";
mail($to, $subject, $message, $headers);
Take a look at this post . As you said it's a bit complicated but hopefully it will work.
I would recommend using the PEAR Mail_Mime package to easily add attachments.
Once you've created the Mail_Mime
object you'll just need to use it's addAttachment()
method.
精彩评论