email an ms-word attachment (please)
| From: | Jen Hall | Date: | Wed, 21 Mar 2001 00:59:26 +0000 |
| Subject: | email an ms-word attachment (please) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-44855@lists.php.net to get a copy of this message | ||
Hi there
I am trying to build an application where a user can use an
HTML form, fill out some fields, select a file from their
hard drive, and have it emailed as an attachment with the
contents of the form. (essentially, fill in your name and
address, use my module to attach ms-word file of your
resume, send email of all).
I have the part with the file upload working.
I have the snipet of code from phpWizard (Sasha and Tobias)
http://www.phpwizard.net/resources/phpMisc/scripts/pretty/mail.php3
I am able to make it work with an image as the attachment,
but when I select an MS-WORD document, which is the goal of
this application, it still thinks it's an image, and doesn't
work properly.
I think my problem has something to do with the $ctype. I
tried application/MSWORD, but that didn't work.
I think this the line of code where the problem is:
$attachment =
fread(fopen("test.doc", "r"), filesize("test.doc"));
$mail = new mime_mail();
$mail->from = "foo@bar.com";
$mail->headers = "Errors-To:
foo@bar.com";
$mail->to = "bar@foo.com";
$mail->subject = "Testing...";
$mail->body = "This is just a
test.";
$mail->add_attachment("$attachment", "test.doc",
"application/msword");
$mail->send();
Can anyone shed some light on this? Please??????
thanks
-jen
.