Hi there,
I have a script that people can use to refer a page to their friends via email and I wanted to spice up the email a bit so that when the recipient receives it, they see more than just plain text.
Here is the script:
<?php
if (isset($_POST['youremail']))
{
$url = "http://ivegotkids.com/aries";
$email = $_POST['email'] ;
$youremail = $_POST['youremail'] ;
$igkmail = 'noreply@ivegotkids.com' ;
$sender = $_POST['yourname'] ;
$recipient = $_POST['friendname'] ;
$subject = 'I thought you might like this.';
$comment = $_POST['message'] ;
$message = "Hi ". $recipient . ". Your friend " . $sender . " saw this horoscope on ivegotkids.com and thought you might find it interesting: (" . $url . ")
". $sender ." included this message: " . $comment ;
$from = "" . $sender . " (via I\\'ve Got Kids) <" . $igkmail . ">";
$headers = "From: " . $from;
mail($email, $subject, stripslashes($message), $headers);
echo "Thank you! Your mail has been sent.";
}
else
{
echo
'
<img src="http://ivegotkids.com/wp-content/themes/thepink/images/logo.png">
<br /><br />
<span class="formtitle">Send "<span class="pagetitle">I\\'ve Got Kids!: Aries"</span> to a friend by e-mail.</span>
<br />
Fill out the form below and click on submit to send this to your friend.
<br /><br />
<form method="post">
Your Name: <input type="text" name="yourname" length="40"/> <br />
Your Email: <input type="text" name="youremail" length="50"/> <br /><br>
Friend\\'s Name: <input type"text" name="friendname" length="40" /><br>
Friend\\'s E-Mail: <input type="text" name="email" length="50" /><br /><br />
Include a message from you:<br />
<textarea rows="4" cols="50" name="message"> </textarea><br /><br />
<input type="submit" value="Send To Friend">
</form>';
}
?>
The bit I need to change is this:
$message = "Hi ". $recipient . ". Your friend " . $sender . " saw this horoscope on ivegotkids.com and thought you might find it interesting: (" . $url . ")
". $sender ." included this message: " . $comment ;
That is what the recipient receives. I need to spice this up a little. Add some formatting and a logo. How do I include HTML and Inline CSS Statements into this variable without breaking the PHP or having it render as text the other end? I tried to add an <img src> to the beginning but it literally printed out the code in the email rather than displaying the image.