Computing.Net > Forums > Programming > php mail function

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

php mail function

Reply to Message Icon

Name: BigJay2940
Date: March 19, 2007 at 23:24:43 Pacific
OS: windows xp
CPU/Ram: amd barton 2500
Product: me
Comment:

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!



Sponsored Link
Ads by Google

Response Number 1
Name: BigJay2940
Date: March 20, 2007 at 15:29:53 Pacific
Reply:

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


0
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: php mail function

Perl (or PHP) mail function www.computing.net/answers/programming/perl-or-php-mail-function/14685.html

PHP Mail()-function- all on 1 line? www.computing.net/answers/programming/php-mailfunction-all-on-1-line/5142.html

PHP Email Function www.computing.net/answers/programming/php-email-function/10854.html