As I've listed in another thread (here), I'm making a user database. I want to be able to email everyone in this list via a simple form, and use a couple of the variables such as their first name in the email body. Unfortunately, two things are true right now:
1) I don't know where to begin; and
2) I suck ass.
If anyone could help me out I would be ever so grateful... I might even dance a little jig for your viewing pleasure. This is what I just saw in another thread but if I wanted to have a page with just two visible fields - subject and message - and have it automatically insert the information from the message field into the middle of a HTML template, would I just have to appropriately name an input field on a form preceding the following code? :
Code: Select all
<?php
$sendto = "SELECT * FROM street_team";
$sendto = mysql_query($sendto);
$subject = $_POST['subject'];
$message = '<html>
<body>';
$message .= 'some code above my message';
$message .= $_POST['message'];
$message .= 'some code below my message
</body>
</html>';
while ($sending = MySQL_fetch_array($sendto)){
$recipient = $sending['user_name'];
$remail = $sending['user_email'];
$to = $remail;
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "To: {$recipient} <{$remail}>\r\n";
$headers .= "From: Official Mailing List <my@email.com>\r\n";
mail($to, $subject, $message, $headers);
}
?>