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,"glen@gewebsitedevelopment.com","Testing","From: noreply@gewebsitedevelopment.com\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
Share on other sites

iv tried that, if i use for example mail("recipient@wotever.com","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
Share on other sites

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

[code]
$recipient = "noone@woteva.com";
$title = "Test";
$from = "noone@youremai..com";
$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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.