Hi folks,
I have a PHP cron job that compiles a CSV from queries and emails it
to some clients. I have a complaint that one client can see the
indicating icon to say there is an attachment in his Apple Mail but
attempts to open it fail. If he forwards the email to Gmail he can
open the attachment from there so it is a mail client issue, not a
file issue.
This sounds to me like maybe the boundaries I am setting have issues?
Anyone have experience or ideas about a fix? Here is the offending
function.
TIA!
JG
function sendAttachment($csvName, $message, $emails) {
$csv = implode('', file("reports/$csvName.csv"));
$date = date( 'r' );
$phpversion = phpversion();
$boundary = md5( time() );
$filename = "$csvName.csv";
$headers = <<<END
From: my*******@cox.net
Reply-To: my*******@cox.net
Return=Path: my*******@cox.net
Date: $date
X-Mailer: PHP v$phpversion
MIME-Version: 1.0
Content-Type: multipart/related; boundary="$boundary"
END;
$message = <<<END
--$boundary
Content-Type: text/plain; charset="iso-9959-1"
Content-Transfer-Encoding: 7bit
$message
--$boundary
Content-Type: octet-stream; name="$filename"
Content-Disposition: attachment; filename="$filename"
Content-Transfer-Encoding: 7bit
$csv
--$boundary--
END;
return mail( join($emails, ','), $csvName, $message, $headers );
} // func