fooDigi Posted July 28, 2009 Share Posted July 28, 2009 my mail script works on my development server (sends visible html), but once i push and run it on production, it craps out and sends an apparently empty msg, although the email headers seem correct. im guessing it has something to do with server configuration maybe??? thx for any help... my script, simplified... <? # create random boundary string $random_hash = md5(date('r', time())); ob_start(); ?> --PHP-alt-<?php echo $random_hash; ?> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit text version --PHP-alt-<?php echo $random_hash; ?> Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 7bit <strong>html</strong><br /> version --PHP-alt-<?php echo $random_hash; ?>-- <? $html = ob_get_clean(); # configure mail headers $headers = 'MIME-Version: 1.0'."\r\n"; $headers .= "From: fooTest From <[email protected]>\r\n"; $headers .= "Reply-To: fooTest From <[email protected]>\r\n"; $headers .= "Return-Path: fooTest From <[email protected]>\r\n"; $headers .= "Content-Type: multipart/alternative; boundary=\"PHP-alt-$random_hash\"\r\n"; mail('[email protected]', 'Test multipart email', $html, $headers); ?> Link to comment https://forums.phpfreaks.com/topic/167795-multipart-texthtml-mail-issue/ Share on other sites More sharing options...
rhodesa Posted July 28, 2009 Share Posted July 28, 2009 Nothing jumps out at me as being wrong. But if you want to save yourself a headache, I would use this: http://phpmailer.worxware.com/index.php?pg=phpmailer It does all the work needed to send multipart emails including attachments Link to comment https://forums.phpfreaks.com/topic/167795-multipart-texthtml-mail-issue/#findComment-884918 Share on other sites More sharing options...
aschk Posted July 28, 2009 Share Posted July 28, 2009 Does your prodution server support output buffering? Does it support <??> short tags. What mail program/server is it using for mail()? Also bear in mind that you're line delimiters might be different per environment (which is most probably your issue). To be safe use "PHP_EOL" constant instead of relying on your PHP script + environment to contain the correct line delimiters. And last but not least, what does your error logs say? Link to comment https://forums.phpfreaks.com/topic/167795-multipart-texthtml-mail-issue/#findComment-884923 Share on other sites More sharing options...
fooDigi Posted July 28, 2009 Author Share Posted July 28, 2009 rhodesa, thanks for the response... yeah, i usually am against reinventing the wheel, but i have not written any mail scripts supporting multipart messages by hand, and sometimes i just have to learn how to do it myself and unlock the mysteries of how things work... aschk... to answer your questions... yes. yes. sendmail on both. switched to use PHP_EOL, still same issue. no errors when script run. thx Link to comment https://forums.phpfreaks.com/topic/167795-multipart-texthtml-mail-issue/#findComment-884940 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.