开发者

how to mail attachment in php not sure?

开发者 https://www.devze.com 2023-03-05 05:26 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消