Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 992 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

Zend mail - help needed

Thread title: Zend mail - help needed
Reply    
    Thread tools Search this thread Display Modes  
12-07-2011, 11:01 AM
#1
pinzdesign.com is offline pinzdesign.com
Status: I'm new around here
Join date: Feb 2011
Location: Copenhagen/DK
Expertise: php
Software: Paint
 
Posts: 15
iTrader: 0 / 0%
 

pinzdesign.com is on a distinguished road

  Old  Zend mail - help needed

I got a problem with Zend mail - addTo doesn't want to add addresses from an array, thou it does send with a single recipient from another script. It says 'bad syntaxys of recipient'.

Here is code part:

PHP Code:
        // Setting recipient
        
$q mysql_query("SELECT * FROM emailscategoriesmap WHERE fk_categoriesId='".$row['fk_categoriesId']."'");
        while(
$r mysql_fetch_assoc($q))
        {
            
$qu mysql_query("SELECT * FROM emails WHERE emailsId='".$r['fk_emailsId']."' AND emails_status='aktiv'");
            
$res $qu;
            
$e mysql_fetch_assoc($res);
            
$email mysql_real_escape_string($e['address']);
            
$mail->addTo($email$email);
            echo 
"$email<br />
            <pre>"
;
            
print_r($e);
            echo 
"</pre>";
        }
        
$mail->addTo('mail@hotmail.com''mymail');
        
// Setting mail subject
        
$mail->setSubject($row['name']);
        
// Sending mail
        
$setLoggetQuery mysql_query("UPDATE newsletter SET logget='1' WHERE newsletterId='".$row['newsletterId']."'");
        if(!
$setLoggetQuery) { echo "<span>Fejl!Nyhedsbrev blev ikke sendt.</span>"; }
        else {
            
$mail->send($transport);
            echo 
'Mail was sent successfully.';
        }
    } 
and i know for sure that the print_r i call for final query, shows the proper addresses, it just fails to add them one by one with addTo

pls help needed

12-08-2011, 08:18 PM
#2
pinzdesign.com is offline pinzdesign.com
Status: I'm new around here
Join date: Feb 2011
Location: Copenhagen/DK
Expertise: php
Software: Paint
 
Posts: 15
iTrader: 0 / 0%
 

pinzdesign.com is on a distinguished road

  Old

oh i fixed this one!

Reply With Quote
12-08-2011, 08:22 PM
#3
Village Genius is offline Village Genius
Village Genius's Avatar
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
 
Posts: 6,894
iTrader: 18 / 100%
 

Village Genius will become famous soon enough

  Old

Because people may come with the same issue and find this on Google could you explain what you did to fix it? On that subject:

Reply With Quote
Thanked by:
Artashes (12-18-2011)
12-09-2011, 11:59 AM
#4
pinzdesign.com is offline pinzdesign.com
Status: I'm new around here
Join date: Feb 2011
Location: Copenhagen/DK
Expertise: php
Software: Paint
 
Posts: 15
iTrader: 0 / 0%
 

pinzdesign.com is on a distinguished road

  Old

Originally Posted by Village Genius View Post
Because people may come with the same issue and find this on Google could you explain what you did to fix it? On that subject:
well i don't think this can help much, as i had a quite unique error - i removed one of the emails from the table, but didn't remove the subscribed mail categories.

My first query selects all mails, from categoriesmap where category is equal to the one used in to-be-send mail. The table holds only relations, as if it says: mail 5 subscribed to category 7. So when i was getting id's of "broken" mails from this table, and adding them with addTo() in a loop, it inserted a null value, thereafter Zend made a "," and tries to fetch another broken(unexistant) mail(or maybe once is enuf)

So the recipient field was getting something like "mymail@mail.com,,,," on which, of course, Zend was throwing an error.

Reply    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed