开发者

html emails using mail.php

Hi i am creating a email system which works on our devbox but on our 1&1 server i get a internal server error 500. The way which i generate the email is by using a simple_dom_parser which reads a html file and replaces for a specified value. I have managed to get the email to send now and everything works within it. Here is the code

<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<title>Untitled Document</title>
</head>
<body style='margin: 0; padding: 0; background-color: #eaeaea;'>
            <table width='500px' border='0' cellpadding='0' cellspacing='0' style='background-color: #fff; width:500px;' >
                <tr>
                    <td><img src='http://www.completelettingsolutions.co.uk/images/email/email_header.jpg' border='0' /></td>

开发者_开发百科                </tr>
            </table>
            <table width='450px' border='0' cellpadding='0' cellspacing='0' style='background-color: #fff; width:500px;' >
                <tr>
                    <td bgcolor='#FFFFFF' style='padding:0 16px;'  cellpadding='0' cellspacing='0' align="left">
                    <font>
                    <span id='fName' style='text-decoration: none;'></span> 
                        <br><br>
                        We've recieved a request for your password to be reset on Complete Letting Solutions. If you've not requested this then rest assured your details are safe and ignore this email!
                        <br><br>
                        Your Username: <span id='uName' style='text-decoration: none;'></span>
                        <br><br>
                        Your Password:  <span id='returnLink' style='text-decoration: none;'></span>               
                        <br><br>
                        Please note - the password reset link above will expire in 24 hours.
                        <br><br>
                        <font color="#4E69B2" size="2" >
                        <b>
                        Kind Regards,<br>
                        Complete Letting Solutions
                        </b>
                    </font>
                    </font>
                    </td>
                </tr>
            </table>
            <table width='500px' border='0' cellpadding='0' cellspacing='0' style='width:500px;'>
                <tr>
                    <td><img src='http://www.completelettingsolutions.co.uk/images/email/email_foot.jpg' border='0' /></td>
                </tr>
                </table>  
    </body>
    </html>

now all i need to do is align the tables to be centered. Origionaly i was putting them in another table and alignin the td but that gives me a server error. has any one ever experienced this before and does any one know how to fix it? the php versions on both are 5.3.2.

below is the code that dies

<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<title>Untitled Document</title>
</head>
<body style='margin: 0; padding: 0; background-color: #eaeaea;'>
           <table width='100%' border='0' cellpadding='0' cellspacing='0' style='background-color: #eaeaea; width:100%;' >
    <tr>
        <td align='center'>
            <table width='500px' border='0' cellpadding='0' cellspacing='0' style='background-color: #fff; width:500px;' >
                <tr>
                    <td><img src='http://www.completelettingsolutions.co.uk/images/email/email_header.jpg' border='0' /></td>

                </tr>
            </table>
            <table width='450px' border='0' cellpadding='0' cellspacing='0' style='background-color: #fff; width:500px;' >
                <tr>
                    <td bgcolor='#FFFFFF' style='padding:0 16px;'  cellpadding='0' cellspacing='0' align="left">
                    <font>
                    <span id='fName' style='text-decoration: none;'></span> 
                        <br><br>
                        We've recieved a request for your password to be reset on Complete Letting Solutions. If you've not requested this then rest assured your details are safe and ignore this email!
                        <br><br>
                        Your Username: <span id='uName' style='text-decoration: none;'></span>
                        <br><br>
                        Your Password:  <span id='returnLink' style='text-decoration: none;'></span>               
                        <br><br>
                        Please note - the password reset link above will expire in 24 hours.
                        <br><br>
                        <font color="#4E69B2" size="2" >
                        <b>
                        Kind Regards,<br>
                        Complete Letting Solutions
                        </b>
                    </font>
                    </font>
                    </td>
                </tr>
            </table>
            <table width='500px' border='0' cellpadding='0' cellspacing='0' style='width:500px;'>
                <tr>
                    <td><img src='http://www.completelettingsolutions.co.uk/images/email/email_foot.jpg' border='0' /></td>
                </tr>
            </table>
                        </td>
    </tr>
</table>  
</body>
</html>
thank you.


Working Example:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

    <head>
        <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
        <title>Untitled Document</title>
    </head>

    <body style='margin:0; padding:0; background-color:#eaeaea;'>
        <table width='100%' border='0' cellpadding='0' cellspacing='0' style='background-color:#eaeaea; width:100%;' >
            <tr>
                <td align='center'>
                    <table width='500px' border='0' cellpadding='0' cellspacing='0' style='background-color: #fff; width:500px;' >
                        <tr>
                            <td>
                                <img src='http://www.completelettingsolutions.co.uk/images/email/email_header.jpg' border='0' />
                            </td>
                        </tr>
                    </table>
                    <table width='450px' border='0' cellpadding='0' cellspacing='0' style='background-color: #fff; width:500px;' >
                        <tr>
                            <td bgcolor='#FFFFFF' style='padding:0 16px;'  cellpadding='0' cellspacing='0' align="left">
                                <font>
                                    <span id='fName' style='text-decoration: none;'></span>
                                    <br><br>
                                    We've recieved a request for your password to be reset on Complete Letting Solutions. If you've not requested this then rest assured your details are safe and ignore this email!
                                    <br><br>
                                    Your Username: <span id='uName' style='text-decoration: none;'></span>
                                    <br><br>
                                    Your Password:  <span id='returnLink' style='text-decoration: none;'></span>
                                    <br><br>
                                    Please note - the password reset link above will expire in 24 hours.
                                    <br><br>
                                    <font color="#4E69B2" size="2" >
                                        <b>
                                            Kind Regards,<br>
                                            Complete Letting Solutions
                                        </b>
                                    </font>
                                </font>
                            </td>
                        </tr>
                    </table>
                    <table width='500px' border='0' cellpadding='0' cellspacing='0' style='width:500px;'>
                        <tr>
                            <td>
                                <img src='http://www.completelettingsolutions.co.uk/images/email/email_foot.jpg' border='0' />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </body>

</html>

You didn't set the DOC-TYPE, thus the browser couldn't know how to read your code...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜