This one has me stumped.
I have to send a spreadsheet as an attachment. The code I have does it, but its failing on gmail. I don’t know if its something on their end or if its an issue with the headers, but either way, i’m tired of messing with it.
My code as it stands now
[php]$to = "[email protected]";
$subject = ‘PRIORITY: Venzo Digital Priority List/HistList - ‘.$sdate;
$random_hash = md5(date(‘r’, time()));
$headers = “From: ADAM [email protected]”."\r\n";
$headers .= “Cc: [email protected]”."\r\n";
$headers .= “MIME-Verson: 1.0”;
$headers .= “Content-Type: multipart/mixed; boundary=“PHP-mixed-”.$random_hash.”"";
$attachment = chunk_split(base64_encode(file_get_contents(’…/itunes_marketing/’.$filename)));
ob_start(); //Turn on output buffering
?>
–PHP-mixed-<?php echo $random_hash; ?>
Content-Type: multipart/alternative; boundary=“PHP-alt-<?php echo $random_hash; ?>”
–PHP-alt-<?php echo $random_hash; ?>
Content-Type: text/html; charset=“iso-8859-1”
Content-Transfer-Encoding: 7bit
ADAM here. I just want to inform you that the attachment provided is the Priority List/HitList provided by Venzo Music for the store date of: <?=$sdate?>
Please send this list to the appropriate Program Editor to secure possible feature placements on the iTunes Store. A Venzo Digital Representative will reach out to you within 24-72 hours with additional marketing materials to further provide the best possible review.
We thank you for reviewing our list and hope that you feature our titles. Thank you for being a Valued Partner!
Best,
ADAM
Intranet Personality (Automated System)
Venzo Digital
http://www.venzodigital.com
–PHP-alt-<?php echo $random_hash; ?>–
–PHP-mixed-<?php echo $random_hash; ?>
Content-Type: application/vnd.ms-excel; name="<?=$filename?>"
Content-Transfer-Encoding: base64
Content-Disposition: attachment
–PHP-mixed-<?php echo $random_hash; ?>–
<?php $message = ob_get_clean(); $mail_sent = @mail( $to, $subject, $message, $headers ); echo $mail_sent ? "Mail sent to $to" : "Mail failed"; ?>[/php]I pulled the code from a websheets tutorial, it works fine with Hotmail (which is what I use), just not with gmail, unsure of other applications.