Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP mass email problem



9:08 pm on Sep 8, 2003 (gmt 0)

10+ Year Member

Here's the code:
$colname_rs_list = "1";
if (isset($HTTP_GET_VARS['id'])) {
$colname_rs_list = (get_magic_quotes_gpc())? $HTTP_GET_VARS['id'] : addslashes($HTTP_GET_VARS['id']);
mysql_select_db($database_calendar, $calendar);
$query_rs_list = sprintf("SELECT emailaddress, calendarmssgs.title FROM calendareventreg, calendarmssgs WHERE event = %s AND calendarmssgs.id = calendareventreg.event", $colname_rs_list);
$rs_list = mysql_query($query_rs_list, $calendar) or die(mysql_error());
$row_rs_list = mysql_fetch_assoc($rs_list);
$totalRows_rs_list = mysql_num_rows($rs_list);

$subject = $row_rs_list["calendarmssgs.title"];
$message = "This message is to remind you that you are registered for the class at Mere Bulles on 10/1/03 at 5:30pm.";
do {
$to = $row_rs_list['emailaddress'];
mail($to, $subject, $message, "From: some person <info@site.com>");
} while ($row_rs_list = mysql_fetch_assoc($rs_list));


header ( "Location: [site.com...]

id is passed from a form to process a list of attendees to an event. When the code is run I get an email error in the inbox where it says that no recipient email address was added. The script runs perfectly if it is output in a table. Any ideas?

[edited by: jatar_k at 9:53 pm (utc) on Sep. 8, 2003]
[edit reason] generalized emails and url [/edit]


1:21 pm on Sep 9, 2003 (gmt 0)

10+ Year Member

mail($to, $subject, $message, "From: some person <info@site.com>");

Not sure if this will make a difference for you but a properly formated From header should look like:

mail($to, $subject, $message, "From: \"some person\" <info@site.com>\n");

The persons name *should* be in quotes. And each header *must* end with a new line.



3:50 pm on Sep 9, 2003 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

another thing to try would be to echo $to and comment out the mail call to make sure that the recipient is actually being set here.

$to = $row_rs_list['emailaddress'];


Featured Threads

Hot Threads This Week

Hot Threads This Month