Formatting an email message in PHP

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I have a script that takes name and email address from a form on one
of my pages.  I need to format a message that looks professional.  How
would I create the string that is used in the message portion of the
command.  To see the page with the form go to
This will become the index page when I get the formatting corrected.

<<start code snippet>>

if(validate_form($name, $email)) {
        mail($to, $subject, $message, $headers);
        $reply_name = '';
        $reply_addr = '';
        $to = $_POST['email'];
            $subject = 'Natural Remedies Ebook Delivery';
        $message = "$name,\r\rAgain, thank you for requesting Natural
Remedies to Common Ailments.\r\n Please go to
and select save target as.  You will be able to (save the file) to
your computer to review at your leisure.\rWe are constantly updating
and enhancing this document and will keep you up to date on how it is
progressing.\r\rKenn\r\nHerbal Vista LLC\rKennon Ward, email \r Aurelia Ward, email\n1
(877) 209-1331";
        $headers = "From: $reply_name <$reply_addr> \r\nReply-To:$reply_addr
\r\nContent-Type: text/plain; charset=UTF-8\r\nX-Mailer:
        mail($to, $subject, $message, $headers);
    } else {
} else {

<<end code snippet>>

Any help would be greatly appreciated.  Thanks

Re: Formatting an email message in PHP

kennward wrote:
Quoted text here. Click to load it

Do this and soon your site will be flagged as a spam provider in every
major spam database around.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: Formatting an email message in PHP

I suggest you to use PhpMailer and store your e-mails in some kind of
template files.
This way it will be easier for you to change the e-mail appearance and
PhpMailer will make it easier to attach attachments or send e-mails in both
HTML and TXT format.


Site Timeline