Loading entire HTML email into single variable
<p>The following variable with all the mark up for an email in it is causing a 500 error and I am not sure why because it worked fine on another server. </p>

<p>I tried to use</p>

<pre><code>        $cust_email = file_get_contents(ROOT.'email.txt'); 
</code></pre>

<p>and put the mark up in a text file but then of course the variables within the email are not interpreted. Is there any way to use file_get_contents; and still have the variables in the file interpreted as variables? Alternatively what is a better way of handling this? </p>

<pre><code> // Customer Order Confirmation Email
$cust_email = '&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;

    &lt;!-- Facebook sharing information tags --&gt;
    &lt;meta property="og:title" content="*|MC:SUBJECT|*" /&gt;

    &lt;title&gt;Order Conformation&lt;/title&gt;
    &lt;style type="text/css"&gt;
        /* Client-specific Styles */
        #outlook a{padding:0;} /* Force Outlook to provide a "view in browser" button. */
        body{width:100% !important;} .ReadMsgBody{width:100%;} .ExternalClass{width:100%;} /* Force Hotmail to display emails at full width */
        body{-webkit-text-size-adjust:none;} /* Prevent Webkit platforms from changing default text sizes. */

        /* Reset Styles */
        body{margin:0; padding:0;}
        img{border:0; height:auto; line-height:100%; outline:none; text-decoration:none;}
        table td{border-collapse:collapse;}
        #backgroundTable{height:100% !important; margin:0; padding:0; width:100% !important;}

        /* Template Styles */

        /* /\/\/\/\/\/\/\/\/\/\ STANDARD STYLING: COMMON PAGE ELEMENTS /\/\/\/\/\/\/\/\/\/\ */

        /**
        * @tab Page
        * @section background color
        * @tip Set the background color for your email. You may want to choose one that matches your company\'s branding.
        * @theme page
        */
        body, #backgroundTable{
            /*@editable*/ background-color:#FAFAFA;
        }

        /**
        * @tab Page
        * @section email border
        * @tip Set the border for your email.
        */
        #templateContainer{
            /*@editable*/ border: 1px solid #DDDDDD;
        }

        /**
        * @tab Page
        * @section heading 1
        * @tip Set the styling for all first-level headings in your emails. These should be the largest of your headings.
        * @style heading 1
        */
        h1, .h1{
            /*@editable*/ color:#202020 !important;
            display:block;
            /*@editable*/ font-family:Arial;
            /*@editable*/ font-size:34px;
            /*@editable*/ font-weight:bold;
            /*@editable*/ line-height:100%;
            margin-top:0;
            margin-right:0;
            margin-bottom:10px;
            margin-left:0;
            /*@editable*/ text-align:left;
        }

        /**
        * @tab Page
        * @section heading 2
        * @tip Set the styling for all second-level headings in your emails.
        * @style heading 2
        */
        h2, .h2{
            /*@editable*/ color:#202020 !important;
            display:block;
            /*@editable*/ font-family:Arial;
            /*@editable*/ font-size:30px;
            /*@editable*/ font-weight:bold;
            /*@editable*/ line-height:100%;
            margin-top:0;
            margin-right:0;
            margin-bottom:10px;
            margin-left:0;
            /*@editable*/ text-align:left;
        }

        /**
        * @tab Page
        * @section heading 3
        * @tip Set the styling for all third-level headings in your emails.
        * @style heading 3
        */
        h3, .h3{
            /*@editable*/ color:#202020 !important;
            display:block;
            /*@editable*/ font-family:Arial;
            /*@editable*/ font-size:22px;
            /*@editable*/ font-weight:bold;
            /*@editable*/ line-height:100%;
            margin-top:0;
            margin-right:0;
            margin-bottom:5px;
            margin-left:0;
            /*@editable*/ text-align:left;
            border-bottom:4px solid #D5A34C;
        }

        /**
        * @tab Page
        * @section heading 4
        * @tip Set the styling for all fourth-level headings in your emails. These should be the smallest of your headings.
        * @style heading 4
        */
        h4, .h4{
            /*@editable*/ color:#202020 !important;
            display:block;
            /*@editable*/ font-family:Arial;
            /*@editable*/ font-size:15px;
            /*@editable*/ font-weight:bold;
            /*@editable*/ line-height:100%;
            margin-top:0;
            margin-right:0;
            margin-bottom:10px;
            margin-left:0;
            /*@editable*/ text-align:center;

        }

        /* /\/\/\/\/\/\/\/\/\/\ STANDARD STYLING: PREHEADER /\/\/\/\/\/\/\/\/\/\ */

        /**
        * @tab Header
        * @section preheader style
        * @tip Set the background color for your email\'s preheader area.
        * @theme page
        */
        #templatePreheader{
            /*@editable*/ background-color:#FAFAFA;
        }

        /**
        * @tab Header
        * @section preheader text
        * @tip Set the styling for your email\'s preheader text. Choose a size and color that is easy to read.
        */
        .preheaderContent div{
            /*@editable*/ color:#505050;
            /*@editable*/ font-family:Arial;
            /*@editable*/ font-size:10px;
            /*@editable*/ line-height:100%;
            /*@editable*/ text-align:left;
        }

        /**
        * @tab Header
        * @section preheader link
        * @tip Set the styling for your email\'s preheader links. Choose a color that helps them stand out from your text.
        */
        .preheaderContent div a:link, .preheaderContent div a:visited, /* Yahoo! Mail Override */ .preheaderContent div a .yshortcuts /* Yahoo! Mail Override */{
            /*@editable*/ color:#336699;
            /*@editable*/ font-weight:normal;
            /*@editable*/ text-decoration:underline;
        }

        /* /\/\/\/\/\/\/\/\/\/\ STANDARD STYLING: HEADER /\/\/\/\/\/\/\/\/\/\ */

        /**
        * @tab Header
        * @section header style
        * @tip Set the background color and border for your email\'s header area.
        * @theme header
        */
        #templateHeader{
            /*@editable*/ background-color:#000000;
            /*@editable*/ border-bottom:0;
        }

        /**
        * @tab Header
        * @section header text
        * @tip Set the styling for your email\'s header text. Choose a size and color that is easy to read.
        */
        .headerContent{
            /*@editable*/ color:#202020;
            /*@editable*/ font-family:Arial;
            /*@editable*/ font-size:34px;
            /*@editable*/ font-weight:bold;
            /*@editable*/ line-height:100%;
            /*@editable*/ text-align:left;
            /*@editable*/ vertical-align:middle;
        }

        /**
        * @tab Header
        * @section header link
        * @tip Set the styling for your email\'s header links. Choose a color that helps them stand out from your text.
        */
        .headerContent a:link, .headerContent a:visited, /* Yahoo! Mail Override */ .headerContent a .yshortcuts /* Yahoo! Mail Override */{
            /*@editable*/ color:#336699;
            /*@editable*/ font-weight:normal;
            /*@editable*/ text-decoration:underline;
        }

        #headerImage{
            height:auto;
            max-width:650px !important;
        }

        /* /\/\/\/\/\/\/\/\/\/\ STANDARD STYLING: MAIN BODY /\/\/\/\/\/\/\/\/\/\ */

        /**
        * @tab Body
        * @section body style
        * @tip Set the background color for your email\'s body area.
        */
        #templateContainer, .bodyContent{
            /*@editable*/ background-color:#FFFFFF;
        }

        /**
        * @tab Body
        * @section body text
        * @tip Set the styling for your email\'s main content text. Choose a size and color that is easy to read.
        * @theme main
        */
        .bodyContent div{
            /*@editable*/ color:#505050;
            /*@editable*/ font-family:Arial;
            /*@editable*/ font-size:14px;
            /*@editable*/ line-height:150%;
            /*@editable*/ text-align:left;
        }

        /**
        * @tab Body
        * @section body link
        * @tip Set the styling for your email\'s main content links. Choose a color that helps them stand out from your text.
        */
        .bodyContent div a:link, .bodyContent div a:visited, /* Yahoo! Mail Override */ .bodyContent div a .yshortcuts /* Yahoo! Mail Override */{
            /*@editable*/ color:#336699;
            /*@editable*/ font-weight:normal;
            /*@editable*/ text-decoration:underline;
        }

        .bodyContent img{
            display:inline;
            height:auto;
        }

        /* /\/\/\/\/\/\/\/\/\/\ STANDARD STYLING: FOOTER /\/\/\/\/\/\/\/\/\/\ */

        /**
        * @tab Footer
        * @section footer style
        * @tip Set the background color and top border for your email\'s footer area.
        * @theme footer
        */
        #templateFooter{
            /*@editable*/ background-color:#FFFFFF;
            /*@editable*/ border-top:0;
        }

        /**
        * @tab Footer
        * @section footer text
        * @tip Set the styling for your email\'s footer text. Choose a size and color that is easy to read.
        * @theme footer
        */
        .footerContent div{
            /*@editable*/ color:#505050;
            /*@editable*/ font-family:Arial;
            /*@editable*/ font-size:14px;
            /*@editable*/ line-height:125%;
            /*@editable*/ text-align:left;
        }
        } 
    &lt;/style&gt;
&lt;/head&gt;
&lt;body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0"&gt;
    &lt;center&gt;
        &lt;table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="backgroundTable"&gt;
            &lt;tr&gt;
                &lt;td align="center" valign="top"&gt;
                    &lt;!-- // Begin Template Preheader \\ --&gt;
                    &lt;table border="0" cellpadding="10" cellspacing="0" width="650" id="templatePreheader"&gt;
                        &lt;tr&gt;
                            &lt;td valign="top" class="preheaderContent"&gt;

                                &lt;!-- // Begin Module: Standard Preheader \ --&gt;
                                &lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
                                    &lt;tr&gt;
                                        &lt;td valign="top"&gt;
                                            &lt;div mc:edit="std_preheader_content"&gt;

                                            &lt;/div&gt;
                                        &lt;/td&gt;
                                        &lt;!-- *|IFNOT:ARCHIVE_PAGE|* --&gt;
                                        &lt;td valign="top" width="190"&gt;
                                            &lt;div mc:edit="std_preheader_links"&gt;
                                            &lt;/div&gt;
                                        &lt;/td&gt;
                                        &lt;!-- *|END:IF|* --&gt;
                                    &lt;/tr&gt;
                                &lt;/table&gt;
                                &lt;!-- // End Module: Standard Preheader \ --&gt;

                            &lt;/td&gt;
                        &lt;/tr&gt;
                    &lt;/table&gt;
                    &lt;!-- // End Template Preheader \\ --&gt;
                    &lt;table border="0" cellpadding="0" cellspacing="0" width="650" id="templateContainer"&gt;
                        &lt;tr&gt;
                            &lt;td align="center" valign="top"&gt;
                                &lt;!-- // Begin Template Header \\ --&gt;
                                &lt;table border="0" cellpadding="5" cellspacing="0" width="650" id="templateHeader"&gt;
                                    &lt;tr&gt;
                                        &lt;td class="headerContent" bgcolor="black"&gt;

                                            &lt;!-- // Begin Module: Standard Header Image \\ --&gt;
                                            &lt;a href="http://www.thebullionstore.co.uk"&gt;
                                               &lt;img src="http://www.thebullionstore.co.uk/Images/StyleImages/logo.png" alt="The BullionStore Logo" style="max-width:650px;" id="headerImage campaign-icon" mc:label="header_image" mc:edit="header_image" mc:allowdesigner mc:allowtext /&gt;
                                            &lt;/a&gt;
                                            &lt;!-- // End Module: Standard Header Image \\ --&gt;

                                        &lt;/td&gt;
                                    &lt;/tr&gt;
                                &lt;/table&gt;
                                &lt;!-- // End Template Header \\ --&gt;
                            &lt;/td&gt;
                        &lt;/tr&gt;
                        &lt;tr&gt;
                            &lt;td align="center" valign="top"&gt;
                                &lt;!-- // Begin Template Body \\ --&gt;
                                &lt;table border="0" cellpadding="0" cellspacing="0" width="650" id="templateBody"&gt;
                                    &lt;tr&gt;
                                        &lt;td valign="top" class="bodyContent"&gt;

                                            &lt;!-- // Begin Module: Standard Content \\ --&gt;
                                            &lt;table border="0" cellpadding="20" cellspacing="0" width="100%"&gt;
                                                &lt;tr&gt;
                                                    &lt;td valign="top"&gt;
                                                        &lt;div mc:edit="std_content00"&gt;
                                                            &lt;h3 class="h3"&gt;Order Conformation&lt;/h3&gt;
                                                            &lt;h4&gt;***THIS IS AN AUTOMATED E-MAIL, PLEASE DO NOT REPLY***&lt;/h4&gt;
                                                            Dear '.$cust_details-&gt;strTitle.' '.$cust_details-&gt;strForename.' '.$$cust_details-&gt;strSurname.',
                                                            &lt;br /&gt;
                                                            &lt;br /&gt;
                                                            The BullionStore.co.uk would like to thank you for your order.
                                                            &lt;br /&gt;
                                                            &lt;br /&gt;
                                                             Your reference number is &lt;strong&gt;(REF#'.sprintf("%06d", $order_id).')&lt;/strong&gt; please keep a note of this and quote the reference number if you have any enquiries regarding your order.
                                                            &lt;br /&gt;
                                                            &lt;br /&gt;
                                                             '.$note.'
                                                        &lt;/div&gt;
                                                    &lt;/td&gt;
                                                &lt;/tr&gt;
                                            &lt;/table&gt;
                                            &lt;!-- // End Module: Standard Content \\ --&gt;
                                            &lt;!-- // Begin Module: Standard Content \\ --&gt;
                                            &lt;table border="0" cellpadding="20" cellspacing="0" width="100%"&gt;
                                                &lt;tr&gt;
                                                    &lt;td valign="top"&gt;
                                                        &lt;hr size="4" style="color: #D5A34C; background-color: #D5A34C; border:0;" /&gt;
                                                        &lt;div mc:edit="std_content00"&gt;
                                                            &lt;table&gt;
                                                                &lt;tr&gt;
                                                                    &lt;td width="250" style="text-decoration: underline;"&gt;&lt;strong&gt;Collection Details&lt;/strong&gt;&lt;/td&gt;
                                                                    &lt;td width="100"&gt;&amp;nbsp;&lt;/td&gt;
                                                                    &lt;td width="250" style="text-decoration: underline;"&gt;&lt;strong&gt;Collection Hours&lt;/strong&gt;&lt;/td&gt;
                                                                &lt;/tr&gt;
                                                                &lt;tr&gt;
                                                                    &lt;td&gt;
                                                                        1 The Merchant Building,&lt;br /&gt;
                                                                        25 Gallow Gate&lt;br /&gt;
                                                                        Glasgow&lt;br /&gt;
                                                                        G1 5AA &lt;br /&gt;
                                                                        Tel: 01415525007&lt;br /&gt;&lt;br /&gt;
                                                                        Email: info@thebullionstore.co.uk
                                                                    &lt;/td&gt;
                                                                    &lt;td&gt;&amp;nbsp;&lt;/td&gt;
                                                                    &lt;td&gt;
                                                                        &lt;table&gt;
                                                                            &lt;tr&gt;
                                                                                &lt;td&gt;MON:&lt;/td&gt;
                                                                                &lt;td&gt;09:30 - 17:30&lt;/td&gt;
                                                                            &lt;/tr&gt;
                                                                            &lt;tr&gt;
                                                                                &lt;td&gt;TUE:&lt;/td&gt;
                                                                                &lt;td&gt;09:30 - 17:30&lt;/td&gt;
                                                                            &lt;/tr&gt;
                                                                            &lt;tr&gt;
                                                                                &lt;td&gt;WED:&lt;/td&gt;
                                                                                &lt;td&gt;09:30 - 17:30&lt;/td&gt;
                                                                            &lt;/tr&gt;
                                                                            &lt;tr&gt;
                                                                                &lt;td&gt;THU:&lt;/td&gt;
                                                                                &lt;td&gt;09:30 - 17:30&lt;/td&gt;
                                                                            &lt;/tr&gt;
                                                                            &lt;tr&gt;
                                                                                &lt;td&gt;FRI:&lt;/td&gt;
                                                                                &lt;td&gt;09:30 - 17:30&lt;/td&gt;
                                                                            &lt;/tr&gt;
                                                                            &lt;tr&gt;
                                                                                &lt;td&gt;SAT:&lt;/td&gt;
                                                                                &lt;td&gt;10:30 - 17:00&lt;/td&gt;
                                                                            &lt;/tr&gt;
                                                                            &lt;tr&gt;
                                                                                &lt;td&gt;SUN:&lt;/td&gt;
                                                                                &lt;td&gt;11:00 - 16:00&lt;/td&gt;
                                                                            &lt;/tr&gt;
                                                                        &lt;/table&gt;
                                                                    &lt;/td&gt;
                                                                &lt;/tr&gt;
                                                            &lt;/table&gt;
                                                        &lt;/div&gt;
                                                    &lt;/td&gt;
                                                &lt;/tr&gt;
                                            &lt;/table&gt;
                                            &lt;!-- // End Module: Standard Content \\ --&gt;
                                             &lt;!-- // Begin Module: Standard Content \\ --&gt;
                                            &lt;table border="0" cellpadding="20" cellspacing="0" width="100%"&gt;
                                                &lt;tr&gt;
                                                    &lt;td valign="top"&gt;
                                                        &lt;hr size="4" style="color: #D5A34C; background-color: #D5A34C; border:0;" /&gt;
                                                        &lt;div mc:edit="std_content00" &gt;
                                                        &lt;table&gt;
                                                                &lt;tr&gt;
                                                                    &lt;td width="250" style="text-decoration: underline;"&gt;&lt;strong&gt;Billing Address&lt;/strong&gt;&lt;/td&gt;
                                                                    &lt;td width="100"&gt;&amp;nbsp;&lt;/td&gt;
                                                                    &lt;td width="250" style="text-decoration: underline;"&gt;&lt;strong&gt;Delivery Address&lt;/strong&gt;&lt;/td&gt;
                                                                &lt;/tr&gt;
                                                                &lt;tr&gt;
                                                                    &lt;td&gt;
                                                                        '.$billing_name.'&lt;br /&gt;
                                                                        '.$billing_address1.'&lt;br /&gt;
                                                                        '.$billing_address2.'
                                                                        '.$billing_city.'
                                                                        '.$billing_county.'
                                                                        '.$billing_postcode.'&lt;br /&gt;
                                                                        '.$billing_country.'&lt;br /&gt;
                                                                    &lt;/td&gt;
                                                                    &lt;td&gt;&amp;nbsp;&lt;/td&gt;
                                                                    &lt;td&gt;
                                                                        '.$delivery_name.'&lt;br /&gt;
                                                                        '.$delivery_addy.'&lt;br /&gt;
                                                                        '.$delivery_addy2.'&lt;br /&gt;
                                                                        '.$delivery_city.'&lt;br /&gt;
                                                                        '.$delivery_county.'&lt;br /&gt;
                                                                        '.$delivery_postcode.'&lt;br /&gt;
                                                                        '.$delivery_country.'&lt;br /&gt;
                                                                    &lt;/td&gt;
                                                                &lt;/tr&gt;
                                                            &lt;/table&gt;
                                                        &lt;/div&gt;
                                                    &lt;/td&gt;
                                                &lt;/tr&gt;
                                            &lt;/table&gt;
                                            &lt;!-- // End Module: Standard Content \\ --&gt;
                                             &lt;!-- // Begin Module: Standard Content \\ --&gt;
                                            &lt;table border="0" cellpadding="20" cellspacing="0" width="100%"&gt;
                                                &lt;tr&gt;
                                                    &lt;td valign="top"&gt;
                                                        &lt;hr size="4" style="color: #D5A34C; background-color: #D5A34C; border:0;" /&gt;
                                                        &lt;div mc:edit="std_content00"&gt;
                                                            &lt;strong style="text-decoration: underline;"&gt;Your Order Summery&lt;/strong&gt; 
                                                            &lt;br /&gt;&lt;br /&gt;
                                                            &lt;table width="100%"&gt;
                                                                &lt;tr&gt;
                                                                    &lt;td style="border-bottom: 1px solid #505050;" &gt;&lt;strong&gt;Item Description&lt;/strong&gt;&lt;/td&gt;
                                                                    &lt;td style="border-bottom: 1px solid #505050;"&gt;&lt;strong&gt;Quantity&lt;/strong&gt;&lt;/td&gt;
                                                                    &lt;td style="border-bottom: 1px solid #505050;"&gt;&lt;strong&gt;Price (&amp;pound;)&lt;/strong&gt;&lt;/td&gt;
                                                                &lt;/tr&gt;
                                                                '.$order_data.'
                                                                &lt;tr&gt;
                                                                    &lt;td style="border-top: 1px solid #505050;"&gt;&lt;strong&gt;Payment Method:&lt;/strong&gt;&lt;/td&gt;
                                                                    &lt;td style="border-top: 1px solid #505050;"&gt;'.$payment_method.'&lt;/td&gt;
                                                                    &lt;td style="border-top: 1px solid #505050;"&gt;&amp;nbsp;&lt;/td&gt;
                                                                &lt;/tr&gt;
                                                                &lt;tr&gt;
                                                                    &lt;td colspan="2" align="right"&gt;&lt;strong&gt;VAT : &lt;/strong&gt;&lt;/td&gt;
                                                                    &lt;td&gt;&amp;pound;'.$cart-&gt;curVat.'&lt;/td&gt;
                                                                &lt;/tr&gt;
                                                                &lt;tr&gt;
                                                                    &lt;td colspan="2" align="right"&gt;&lt;strong&gt;SHIPPING : &lt;/strong&gt;&lt;/td&gt;
                                                                    &lt;td&gt;&amp;pound;'.$cart-&gt;curShippingFee.'&lt;/td&gt;
                                                                &lt;/tr&gt;
                                                                &lt;tr&gt;
                                                                    &lt;td colspan="2" align="right"&gt;&lt;strong&gt;TOTAL : &lt;/strong&gt;&lt;/td&gt;
                                                                    &lt;td&gt;&amp;pound;'.$cart-&gt;curTotal.'&lt;/td&gt;
                                                                &lt;/tr&gt;
                                                            &lt;/table&gt;
                                                        &lt;/div&gt;    
                                                    &lt;/td&gt;
                                                &lt;/tr&gt;
                                            &lt;/table&gt;
                                            &lt;!-- // End Module: Standard Content \\ --&gt;
                                        &lt;/td&gt;
                                    &lt;/tr&gt;
                                &lt;/table&gt;
                                &lt;!-- // End Template Body \\ --&gt;
                            &lt;/td&gt;
                        &lt;/tr&gt;
                        &lt;tr&gt;
                            &lt;td align="center" valign="top"&gt;
                                &lt;!-- // Begin Template Footer \\ --&gt;
                                &lt;table border="0" cellpadding="10" cellspacing="0" width="650" id="templateFooter"&gt;
                                    &lt;tr&gt;
                                        &lt;td valign="top" class="footerContent"&gt;

                                            &lt;!-- // Begin Module: Standard Footer \\ --&gt;
                                            &lt;table border="0" cellpadding="10" cellspacing="0" width="100%"&gt;
                                                &lt;tr&gt;
                                                    &lt;td colspan="2" &gt;
                                                    &lt;hr size="4" style="color: #D5A34C; background-color: #D5A34C; border:0;" /&gt;
                                                        &lt;div mc:edit="std_social"&gt;
                                                        '.$transfer_deatils.'
                                                            &lt;strong&gt;Any Questions?&lt;/strong&gt;
                                                            &lt;br /&gt;
                                                            If you have any questions regarding your order simply use the &lt;a href="http://www.thebullionstore.co.uk/contact/"&gt;contact page&lt;/a&gt; on our website quoting your order number.     
                                                        &lt;/div&gt;
                                                    &lt;/td&gt;
                                                &lt;/tr&gt;
                                            &lt;/table&gt;
                                            &lt;!-- // End Module: Standard Footer \\ --&gt;
                                        &lt;/td&gt;
                                    &lt;/tr&gt;
                                &lt;/table&gt;

                            &lt;/td&gt;
</code></pre>
