Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8

Thread: mail() error

  1. #1
    Regular Coder
    Join Date
    Jul 2003
    Location
    New Zealand
    Posts
    435
    Thanks
    1
    Thanked 0 Times in 0 Posts

    mail() error

    PHP Code:
    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

  • #2
    New Coder
    Join Date
    Apr 2004
    Location
    Texas
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you might try turning on display_errors in the php.ini to see what error you're getting...that's often helpful....
    Jason B

  • #3
    Regular Coder
    Join Date
    Jul 2003
    Location
    New Zealand
    Posts
    435
    Thanks
    1
    Thanked 0 Times in 0 Posts
    thanks ill try that

  • #4
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    very obvious error:

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

    so should be
    PHP Code:
    while($row mysql_fetch_assoc($query)){  
             
    $email $row['Email'];  
    ... 
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #5
    New Coder
    Join Date
    Apr 2004
    Location
    Texas
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hehe....yeah I guess that helps....I looked right past it.....
    Jason B

  • #6
    Regular Coder
    Join Date
    Jul 2003
    Location
    New Zealand
    Posts
    435
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by raf
    very obvious error:

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

    so should be
    PHP Code:
    while($row mysql_fetch_assoc($query)){  
             
    $email $row['Email'];  
    ... 
    how did i miss that. sorry guys lol

  • #7
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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) )
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #8
    Regular Coder
    Join Date
    Jul 2003
    Location
    New Zealand
    Posts
    435
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by raf
    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) )
    everyone does it sometimes


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •