Re: Email::send() in a loop. (1.2.x.x)
Now I'm confusedCDMoyer, you posted the link to the ticket, but did you read it? One reply says you need to reset(), the other reply says that the header problem was fixed 6 months ago... Right, this is not the header issue, and just like in the bug I linked, reset() is not the ideal solution. (that bug was closed with Email-reset() and them opened and fixed as requested) reset() would reset all the fields, whereas my application only changes the to: field and calls send. If that's not a supported use, that's fine, it just seems like a pretty common scenario Has everybody forgotten how to search? Wow, I actually did search, I swear. Firefox autocompletes the search form up above: Email body duplicate Email send() duplicate Email send() email body double I fail. ;) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Email::send() in a loop. (1.2.x.x)
Posting fixes here isn't going to help dude...You heed to head over to trac and submit a NEW ticket... I'm just following the instructions on Trac that say to always mail the list first if you think something is a bug. ;) In the interim I guess you can just set your body manually in the loop. That's what I'm doing. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Email::send() in a loop. (1.2.x.x)
I ran into this the other day, I think the behavior is a bit unexpected, and probably a bug. If you do something like: $this-Email-subect = 'Hi!'; $this-Email-from = '[EMAIL PROTECTED]'; foreach ($recipient as $r) { $this-Email-to = $r; $this-Email-send(sprintf($body, $r)); } Essentially, setting up the basic email, and then looping over people and sending by passing the body to send(), the contents of the body get appended to the last send. I believe this is essentially the same bug as: https://trac.cakephp.org/ticket/3393 A simple fix is: Index: cake/libs/controller/components/email.php === --- cake/libs/controller/components/email.php (revision 6636) +++ cake/libs/controller/components/email.php (working copy) @@ -289,6 +289,7 @@ */ function send($content = null, $template = null, $layout = null) { $this-subject = $this-__encode($this-subject); + $this-__message = ''; $this-__createHeader(); if ($template) { --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---