Msg#: 4617979 posted 8:14 pm on Oct 20, 2013 (gmt 0)
I'm trying to send two small images as email attachments. Unfortunately Yahoo Mail is coming up blank without attachments and AOL Mail is showing all the text below. I mimicked a working email so I'm not sure what I did wrong...
Msg#: 4617979 posted 7:46 pm on Oct 21, 2013 (gmt 0)
Just a few comments... May not make a difference, but the headers would normally be CR+LF separated. They should only be LF separated if that is what's causing the problem.
You also seem to be missing the "MIME-Version" header. This is part of the spec, however, (some) email clients might cope without this.
Just a general comment regarding the use of the output buffer in this instance (or using HEREDOC strings for that matter). The EOL might be dependent on the OS of the server you are using (depending on how you are transferring your files). Move the script from Linux/Windows and the script output could be different. Generally with email generation the line endings are important, so this could be significant.
In order to debug the formatting/boundaries you'll need to echo out the entire email before it's sent.
Msg#: 4617979 posted 6:07 pm on Oct 22, 2013 (gmt 0)
Generally with email generation the line endings are important, so this could be significant.
There's a constant you can use - PHP_EOL. Much safer than using ob or heredoc as Penders pointed out.
There's a case I recall from a job I worked a number of years ago - the type of line break that was being used to build the mail headers was causing a html email to be displayed as plain text in Outlook.
Msg#: 4617979 posted 6:39 pm on Oct 22, 2013 (gmt 0)
There's a constant you can use - PHP_EOL.
Unfortunately PHP_EOL could also be a problem as the value of this constant is dependent on the OS of the server. The line endings need to be fixed and configurable regardless of the server on which the script is installed. (Generally CR+LF for mail headers and LF only for the mail body.)