Re: Send mail with attached
| From: | janet at valade dot com | Date: | Mon, 23 Feb 2004 21:20:02 +0000 |
| Subject: | Re: Send mail with attached | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-178594@lists.php.net to get a copy of this message | ||
In a message dated 2/23/2004 11:41:00 AM Pacific Standard Time,
francesco@automationsoft.biz writes:
>is possible to send an email, with mail() function, with an attached?
>I see on www.php.net but there isn't nothing about this.
>If someone have the solution please send the solution.
>Thanks in advance.
>Frank
You do it by including an email header that instructs that the message be
sent as an attachment, like the following:
$to = "someone@someplace.com";
$subj = "Testing an attachment";
$mess = "This is the test message.";
$headers = "Content-disposition: attachment; filename=test.txt\n";
$mailsend = mail($to,$subj,$mess,$headers);
This will send the message in $mess as an attachment with the filename
test.txt.
Good Luck,
Janet
-----------------------------------
Janet Valade,
Author, PHP & MySQL for Dummies
Author, PHP 5 for Dummies