html emails in php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
londonphp
Forum Newbie
Posts: 4
Joined: Tue Aug 23, 2005 10:51 am

html emails in php

Post by londonphp »

I have got a sign up form for a guestlist and use

Code: Select all

<?php
if (isset($_POST['Submit'])) { 
$from = "From: Guestlist@domain.co.uk";
$to = "".$_REQUEST['Email']."";
$subject = "You are now registered to attend our event";
$body = "




"; 
mail($to, $subject, $body, $from);
}  
?>
I want this is be a html email, or if not just to be able to attach a siganture from an image on the website to be included in the email, Im not sure if i can even use the above format. I used the above since the form fields feed into a database. Any ideas?
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

I had the same question... :arrow: Here
londonphp
Forum Newbie
Posts: 4
Joined: Tue Aug 23, 2005 10:51 am

sorry for being thick, still strugling

Post by londonphp »

so using my variables

Code: Select all

<?php function generateEmail($from, $to, $subject, $body) 
{ 
return <<<STOP 
<html> 

THIS IS WHERE THE HTML GOES


STOP;} 

// .......... 

mail("".$_REQUEST['Email']."", 
"GUESTLIST FORM",generateEmail ($from, $to, $subject, $body); ?>
where does this fit in?

$from = "From: Guestlist@domain.co.uk";
$to = "".$_REQUEST['Email']."";
$subject = "You are now registered to attend";

this all goes in <?php ?> tags in the body does it? also is there no </html> tag?
Post Reply