Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hey guys,
I'm not a big php programmer, but I'm sure someone can help me. My code is as follows. I don't get any error messages, but the emails don't deliver. I'm basically pulling the addresses from a mysql table.
---------CODE----------
mysql_select_db($database_exp, $exp);
$query_find_contact = "SELECT users.email FROM users WHERE users.contact_us = 1";
$find_contact = mysql_query($query_find_contact, $exp) or die(mysql_error());-----other stuff here------
while ($row_find_contact = mysql_fetch_array($find_contact))
{ $to_email .=$find_contact.",";
}
$to_email = substr($to_email, 0, -1);$totalRows_find_contact = mysql_num_rows($find_contact);
$to = "$to_email";
$subject = "Contact Us form from www.website.com";$message = "
<html>
<head>
<title>Contact Us form from website.com</title>
</head>
<body>This email contains HTML Tags!</p>
<table>
<tr><td>Requestor's Name:</td><td>$first_name $last_name</td></tr>
<tr><td>Requestor's Email:</td><td>$email</td></tr>
<tr><td>Requestor's Phone:</td><td>$phone</td></tr>
<tr><td>Requestor's Comments/Question:</td><td>$comment</td></tr>
</table>
</body>
</html>";$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";$headers .= 'From: <website.com>' . "\r\n";
mail($to,$subject,$message,$headers);
-------end code---------
If anyone could help me I'd really appreciate it!

$to = "$to_email"; has quotes around the variable. I'm going to try to remove those tonight and will post an update.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |