mbeals Posted April 15, 2008 Share Posted April 15, 2008 I'm writing a script to auto generate time sheets. I have it parse my syslog file to determine what time my computer was turned on and then turned off, based on log entries, for the past two weeks, calculates hours worked then emails it to me. I have all of that fancy stuff working fine. My problem is that the text won't format correctly. The report I'm generating consists of 2 blocks (one per week) at 5 lines per block. There is a row label followed by information. I have a single subroutine that takes an array and generates this line with the individual elements divided by tabs (\t). When I run this script and dump the report to a web browser (and view the source) it is formatted correctly. All the tabs line up like they should. When I send this report to my outlook account, windows screws up the tabs and has it all over the place. Is there some header info that I'm missing in the email that is causing this? Quote Link to comment https://forums.phpfreaks.com/topic/101226-solved-cross-platform-text-formatting/ Share on other sites More sharing options...
awpti Posted April 15, 2008 Share Posted April 15, 2008 Send it as an attachment. Outlook will always hosebag your output. It's what it was designed to do. Quote Link to comment https://forums.phpfreaks.com/topic/101226-solved-cross-platform-text-formatting/#findComment-517848 Share on other sites More sharing options...
mbeals Posted April 15, 2008 Author Share Posted April 15, 2008 as much as I didn't want to, I just ended up turning it into an HTML formated email message. For future reference, in case someone is searching and stumbles on this, you can do this by adding some stuff to the headers like: $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= "From: ......."; mail($to,$subject,$message,$headers); i left out the other stuff, but apparently the \r\n at the end of each header line is mandatory or windows won't like it. Quote Link to comment https://forums.phpfreaks.com/topic/101226-solved-cross-platform-text-formatting/#findComment-517889 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.