Swift is giving me warnings (was i naughty?)

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Swift is giving me warnings (was i naughty?)

Post by nickvd »

I am using the latest version..

Code: Select all

Warning: preg_match() expects parameter 2 to be string, array given in Swift.php on line 1144
for reference, line 1144 is within "function detectUTF8($string_in){}"

I'm trying to send to multiple recipients, but swift is spitting out the above warning for each recipient in the $to array...

the $to array is:

Code: Select all

array(7) {
  [0]=>
  array(2) {
    [0]=>
    string(10) "Jeff Brown"
    [1]=>
    string(13) "jeff@example.com"
  }
...
...

Code: Select all

require_once('Swift.php');
   require_once('Swift/Connection/SMTP.php');
   $swift = new Swift(new Swift_Connection_SMTP($_config['app']['smtpserver']));

   foreach ($recips as $recip) $to[] = array($recip['name'],$recip['email']); // didnt work with associative indexes, possible feature suggestion *****

   $swift->send($to, $_config['register']['from'], 'Personal Message: I Was Thinking Of You!', $tpl);
   dump($swift->transactions);
   dump($swift->errors);
The Kicker is... i still received the emails perfectly on my isp email account, but so far (20 minutes since i sent them) i havent gotten the one sent to my gmail address... if you need full headers, i can email/pm them to you as i'd prefer not to post them in full on the forums...

Any ideas what's going on??

I haven't tried much to fix it as i have plenty of other work to do on this project...

<edit>
I just recieved the email on my gmail account... usually they arrive instantly, i'm now wondering why it took so long...
</edit>
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

GMail can be strange like that. I've had emails that mysteriously disappear and show up years later.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

I'll have a look at this in an hour or so. Upon first sight of the code you're using it does appear to be a bug :oops:
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

2.1.17 should have fixed this ;)
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Yes, i got this bug on Tuesday...glad it is fixed. Thanks
Post Reply