Dear Sirs:
I am working in the Profesional PHP Programming Book in Chapter 17 with
emails. I can get the add attachment example to work fine, but when I try
the add multiple attachments (all files of type in a directory) I get
various errors. Namely CGI program did not return proper HTTP headers and
memory referenced cannot be read. Is there something I am missing in IIS
maybe. I feel it has something to do with my content-types registered in
IIS. What is different in content-type from the first (single attachment
file) example to the next with multiple attachments? Do I need to register
another content-type listing in IIS? If so, what kind? Please let me know
if you have any answers. The examples are on pages 445-449 in the book.
------->>>>>>>>>Here is my file (not including the include file
mime_mail.inc).----------------->>>>>>>>>>>>>>
<?php
include "mime_mail.inc";
# check whether the user has already submitted an address
if (empty($recipient)) {
?>
Please enter your e-mail address to receive the files:
<FORM>
<INPUT TYPE="text" NAME="recipient">
<INPUT TYPE="submit" VALUE=" OK ">
</FORM>
<?php
exit;
}
print "Sending files to $recipient.<p>";
# set up $mail object
$mail = new mime_mail;
$mail->from = "cullan.crothers@w...";
$mail->to = $recipient;
$mail->subject = "Your files";
$mail->body = "Hello, here are your files.";
$content_type = "text/html";
# open current directory and search for files ending with .jpg
$dir = opendir("."); # "." is the name of
the current directory
while ($filename = readdir($dir))
{
echo("$filename<BR>");
//if(ereg("\.htm$", $filename))
//{
$fd = fopen($filename, "r");
$data = fread($fd, filesize($filename));
fclose($fd);
$mail->add_attachment($data, $filename, $content_type);
print "I've added $filename.<br>";
//}
}
closedir($dir);
# send e-mail
$mail->send();
print "I've sent off the e-mail.";
?>
---------------------->>>>>>>>>>>
I have filetypes in IIS that account for Content-Type html(.htm
and .html) , Content-Type XML(.xml and .xsl), Content-Type image/jpeg(.jpg
and .jpeg), etc.
See what you can make of it.
Thanks;
Cullan Crothers
cullan.crothers@w...