Jump to content


Photo

...by the book: html "tell a friend"-php mail


  • Please log in to reply
1 reply to this topic

#1 soscopyrights

soscopyrights
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 13 August 2006 - 09:22 PM

hi guys... recently I grabbed an php/mysql book. i'm on the php mail chapter. my goald is this:
to do a tell-a-friend page(html- which I made) and the php part.

Now... I managed to receive messages, on my mail, but I'd like to include HTML into that "tell a friend" result...u know...
subject..." SOS wants you to check out this website!" and the content in HTML.
I know I'm kinda' noob, but I'm trying my best...

<?php
$content="html";
mail($to,strtoupper($subject),$content,$from);



?>

You realise the code is incomplete...I've been hearing something about MIME....which I don't know what's about...pls have a bit patience and inlight me...
Thank you.


#2 omerta

omerta
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 24 August 2006 - 07:47 AM

Suppose you have this variable from a form..

$friend_email

// Sending an html mail

		// Your recipient
		$to = ($_GET['friend_email']);

		// subject
		$subject = 'Tell A Friend';

		// message
		$message = 'HTML CODE'; // Insert your html code here

// To send HTML mail, the Content-type header must be set
			$headers  = 'MIME-Version: 1.0' . "\r\n";
			$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
	
			// Additional headers
			
			$headers .= 'From: Your Site Name <admin@yoursite.com>' . "\r\n";
			
			// Mail it
			mail($to, $subject, $message, $headers);






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users