...

View Full Version : mail() error



Scrowler
04-25-2004, 07:16 AM
if(isset($_POST['SendNewsletter'])){
$title = $_POST['title'];
$letter = $_POST['article'];
$end = '

-----
You are recieving this email because you are signed up to the Overdrive newsletter. To unsubscribe, click <a href="http://www.overdriveband.com/unsubscribe.php?id='.$email.'" target="_blank">here</a>.
';
$letter = $letter.$end;
$query = mysql_query("SELECT * FROM MailingList") or die(mysql_error());
while($send = mysql_fetch_array($query)){
$email = $row['Email'];
mail( $email , $title , $letter ) or die("Error sending mail");
echo '<font color="#009900">Sending of newsletter to ".$email." was successful.</font>';
}
}


when this script is run appropriately, it gets all the way to the mail() function and then dies - Error sending mail.

can mail() not be used in a mysql_fetch_array() ? what 's wrong?

the variable $row['Email'] contains an email address like joe@blog.com

black3842
04-25-2004, 08:44 AM
you might try turning on display_errors in the php.ini to see what error you're getting...that's often helpful....

Scrowler
04-25-2004, 10:30 AM
thanks ill try that

raf
04-25-2004, 10:52 AM
very obvious error:

while($send = mysql_fetch_array($query)){
$email = $row['Email'];

so should be


while($row = mysql_fetch_assoc($query)){
$email = $row['Email'];
...

black3842
04-25-2004, 11:36 AM
hehe....yeah I guess that helps....I looked right past it.....

Scrowler
04-26-2004, 06:40 AM
very obvious error:

while($send = mysql_fetch_array($query)){
$email = $row['Email'];

so should be


while($row = mysql_fetch_assoc($query)){
$email = $row['Email'];
...


:eek: how did i miss that. sorry guys lol

raf
04-26-2004, 10:34 AM
I could tell you what stupid bug i've been screaming and crying about last weekend, just to make you feel better. But i'm not a nice guy, i so i wount :)
(besides, should be obvious that i never need to waste time on tracking down stupid bugs (if any bugs at all) :cool: )

Scrowler
04-27-2004, 11:02 AM
I could tell you what stupid bug i've been screaming and crying about last weekend, just to make you feel better. But i'm not a nice guy, i so i wount :)
(besides, should be obvious that i never need to waste time on tracking down stupid bugs (if any bugs at all) :cool: )

;) everyone does it sometimes



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum