Jump to content

HTML EMAILS


glenelkins

Recommended Posts

Hi

I want to send HTML emails using the information from a premade HTML page. The code to send the mail (testing is):

[code]sendTemplate($template_folder,$template_filename,"[email protected]","Testing","From: [email protected]\r\n Content-type: text/html\r\n") [/code]

The function (sendTemplates)

[code]
// Send Template
    function sendTemplate ($template_folder,$template_filename,$recipient,$title,$headers) {
        $email_body = file_get_contents($template_folder.$template_filename);
        if (!(mail ($recipient,$title,$email_body,$headers))) {
            return(false);
        } else {
            return(true);
        }
    }
[/code]

This always seems to send the emails displaying the whole html code, what am i doing wrong??

cheers
Link to comment
https://forums.phpfreaks.com/topic/11152-html-emails/
Share on other sites

iv tried that, if i use for example mail("[email protected]","Title",<<<EOF MESSAGE INFO EOF;,"headers");

causes an error with the <<<EOF

Parse error: parse error, unexpected T_SL in /home/fhlinux188/g/gewebsitedevelopment.com/user/htdocs/tester.php

even if i create a variable for it like:

$message = <<<EOF <html bla blab balaldfjhbg EOF;
Link to comment
https://forums.phpfreaks.com/topic/11152-html-emails/#findComment-41696
Share on other sites

here is an example of how i would do it, that does not work:

[code]
$recipient = "[email protected]";
$title = "Test";
$from = "[email protected]";
$headers = "From: " . $from;
$header .= "Content-Type: text/html";
$body = <<<EOF
    <html>
        <body>
            <p align="center">
                Random Garbage Text
            </p>
        </body>
    </html>
EOF;

mail ($recipient,$title,$body,$headers);
[/code]

Not getting a parse error with this, but the email is coming through just showing the html tags, not the actual content

it works if i put \r\n in the headers. What is "\r" ??? not sure what that one does
Link to comment
https://forums.phpfreaks.com/topic/11152-html-emails/#findComment-41703
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.