php_begins Posted October 2, 2011 Share Posted October 2, 2011 Hi, I need to send a html image as an email to people. Here is the link http://cs.txstate.edu/~sr1388/Test/.. When I send I send the email by copying the source code(from view source) of that page, everything looks the same except for the fact the registry and review tables dont get aligned side by side . I cannot find what issue is causing it. This is what my email function looks like: <? $content='view-source code here'; echo $content; $to = "me@gmail.com"; $subject = "test"; $body=$content; //$body="hello"; //$message=$total; $from = "webmaster@example.com"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; //$headers .= 'X-Mailer: PHP/' . phpversion() . "\r\n"; $headers .= 'From: Admin <Admin@mysite.com>' . "\r\n"; // Send email if(mail($to,$subject,$body,$headers)) { // Inform the user echo "Your email has been sent"; } else { echo "MAIL not sent"; } ?> Quote Link to comment Share on other sites More sharing options...
Buddski Posted October 2, 2011 Share Posted October 2, 2011 This has nothing to do with the sending of the email. The issue is, email clients do not render HTML the same as they do in a browser. Sadly, you will have to create an "email friendly" version of your HTML code. People think cross-browser compatibility is a pain, with emails its even worse. Quote Link to comment Share on other sites More sharing options...
php_begins Posted October 2, 2011 Author Share Posted October 2, 2011 hmmm..how do i test a 'email friendly mail' that is compatible... I do not know where to start from.. Quote Link to comment Share on other sites More sharing options...
Buddski Posted October 2, 2011 Share Posted October 2, 2011 As I said each email client renders things differently. gmail, hotmail, outlook, thunderbird, windows live mail etc etc have the potential to display emails differently. Even more so with the popularity of smart phones, life in the email design world just got that little more complicated. There is no (that I know of) definitive way to test for email compatibility, my best advice would be to keep the layout as simple as possible, use as little CSS as you can (paddings and margins arent worth anything really in an email).. and (I never thought I would say this) tables are your friend. Quote Link to comment Share on other sites More sharing options...
Psycho Posted October 2, 2011 Share Posted October 2, 2011 Research, build, test . . repeat Do some searching and you will find some resources on the web. Build some test email and check what they look like in various email clients. If you want the email to look "exactly" right your only option will be to create the email out of images. If you have "advanced" styles in the email you are goingto be struggling to get it to look right in various email clients (especially web-based ones). I'd suggest going with a clean, simple design. Quote Link to comment 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.