Re: HTML email with PHP tags



Or...you can do it htat way. I prefer the concatenation method. Easier
for me to read.

bob.chatman@xxxxxxxxx wrote:
You do it just like you do anything else in php, just print them in
there.

<?php
mail('recipient@xxxxxxxx', 'Subject',
"<html><body><p>Username = $username<br />\nPassword =
$password</p></body></html>",
"To: The Receiver <recipient@xxxxxxxx>\n" .
"From: The Sender <sender@xxxxxxxx>\n" .
"MIME-Version: 1.0\n" .
"Content-type: text/html; charset=iso-8859-1");
?>

the only thing you would want to change would be the single quotes
around the body.

UKuser wrote:

Hi Guys,

Not sure if this is possible.

If I'm sending HTML emails, how can I include PHP tags? I've tried the
standard <?php tags and just inserting them anyway, but neither seem to
work. I really just want to format the text to make it look better
rather than putting images etc.

I.e. using this example from sitepoint.com

<?php
mail('recipient@xxxxxxxx', 'Subject',
'<html><body><p>Your <i>message</i> here.</p></body></html>',
"To: The Receiver <recipient@xxxxxxxx>\n" .
"From: The Sender <sender@xxxxxxxx>\n" .
"MIME-Version: 1.0\n" .
"Content-type: text/html; charset=iso-8859-1");
?>

Within the <html> tags I'd like to include variables like $usernames
etc.

Thanks

A



.



Relevant Pages

  • Re: PHP/HTML
    ... all php tags should open and close at the left margin ... always use the bracketing format to set the ... hard to maintain (format, insertion of new content based on new ...
    (alt.php)
  • Re: trying to display image from mysql database
    ... I removed the "extra" php tags (that is what I get from copying someone ... the database, retrives the image data, and then prints ... echo("Image Database Not Available!" ... Why do you always open/close the PHP tags? ...
    (comp.lang.php)
  • Re: cant use include file with php tags
    ... variable the php tags embedded in the include file fail to ... line which means you'll also need to escape quotes within the line. ... php tags at the start and end of any php you have in a file and if there's ...
    (alt.php)
  • Re: [opensuse] Apache2 and PHP5 on 11.1
    ... in my browser I get a message saying that index.php is a pdf file and ... asks what app would I like to open it with. ... One thing that you will have to do is to use the *full* php tags in your code ...
    (SuSE)
  • RE: [PHP] file() ignores PHP tags
    ... [PHP] fileignores PHP tags ... I wanna output several kinds of ascii files. ... Kind regards, ...
    (php.general)