Coder Social home page Coder Social logo

Comments (21)

designermonkey avatar designermonkey commented on May 26, 2024

Is there code to add multiple recipients, like in PHPMailer? If so, splitting by , and foreach to add the recipients would work.

from symphonycms.

nickdunn avatar nickdunn commented on May 26, 2024

An EmailGateway has _recipients property which is an array. The setRecipients() method accepts either a string or an array, but I can't find anywhere in the code where this is actually called!

General::sendEmail() used to be a straight wrapper for PHPs mail() function, which did accept comma-delimited addresses. So my guess is that the Email or EmailGateway class needs the logic to split the string to populate the recipients array, only I don't know where it should go.

from symphonycms.

designermonkey avatar designermonkey commented on May 26, 2024

It is called dependent on which gateway you're using, but it's very abstract, and difficult to see...

I think the problem is down to the Email Template Filter not splitting your email list before calling the General::sendEmail function.

Backwards compatibility is definitely broken here, but I'd comfortably guess that it needs to be the Email Template Filter that needs updating, not the core.

from symphonycms.

nickdunn avatar nickdunn commented on May 26, 2024

I'm saying the opposite ;-) If the refactoring of General::sendEmail() was just that, refactoring, then the signature and functionality should remain exactly the same and only the internals change. So passing a string containing multiple addresses should be supported by General::sendEmail() API (the Email class should probably handle this).

@michael-e, I think you wrote the majority of the email stuff, could you comment as to where the splitting logic should go?

from symphonycms.

designermonkey avatar designermonkey commented on May 26, 2024

line 133 of `class.emailgateway.php?

from symphonycms.

michael-e avatar michael-e commented on May 26, 2024

@nickdunn: The majority of the code was written by @creativedutchmen. I am on holidays in Italy (and unfortunatley a bit boozed at the moment), but I will take a look tomorrow. At the moment I don't remember breaking backwards compatibility of General::sendEmail(); all I remember is that we made it deprecated.

from symphonycms.

nickdunn avatar nickdunn commented on May 26, 2024

Yeah, but I searched the source for setRecipients and the function is never actually called anywhere, so I'm not sure how this thing works ;-)

from symphonycms.

nickdunn avatar nickdunn commented on May 26, 2024

Holiday? Boozey? The perfect time for coding!

Thanks anyway mate, will keep looking. Enjoy the hols.

from symphonycms.

designermonkey avatar designermonkey commented on May 26, 2024

Nick, try setting line 343 of class.general.php to $email->setRecipients($to_email) and then line 133 of class.emailgateway to $email = explode(', ', $email)

What does that do?

from symphonycms.

michael-e avatar michael-e commented on May 26, 2024

As far as I see at the moment, recipients are set in line 343 of General::sendEmail(). If you look at any of the gateway classes, they are indeed supposed to be an array.

If you don't make it, I can take a look at it tomorrow! Please double-check that recipients indeed used to be a comma-separated list formerly. (I don't remember this, athe moment — boozed...)

Thanks for your understanding! :-)

from symphonycms.

brendo avatar brendo commented on May 26, 2024

Have you updated to the latest Email Template Filter @nickdunn? @rowan-lewis has already fixed the Email Template Filter some time ago

from symphonycms.

michael-e avatar michael-e commented on May 26, 2024

@nickdunn: Is this problem solved?

from symphonycms.

designermonkey avatar designermonkey commented on May 26, 2024

@nickdunn is off until next week now... lazy sod ;o)

from symphonycms.

nickdunn avatar nickdunn commented on May 26, 2024

I pinched the update from Rowan's Email Template Filter (thanks Brendan) which fixed the issue.

from symphonycms.

brendo avatar brendo commented on May 26, 2024

So this can be closed? Or is there a greater issue of setRecipients not working? From the code it looks like setRecipients expects an array of recipients, so it doesn't actually do the exploding for you. This behaviour is consistent with the rest of Symphony's 'plural' set functions, so I think it's ok tbh

from symphonycms.

nickdunn avatar nickdunn commented on May 26, 2024

Fair enough, so long as it's in the API documentation. I raised this because it's a breaking change (backwards), but if this is the first time it's been raised then maybe it's not so much of a problem.

I still think the setRecipients should do some checking. If the string contains commas or semi-colons then split, perhaps?

from symphonycms.

creativedutchmen avatar creativedutchmen commented on May 26, 2024

Yes, I think Nick's suggestion is fair.

If the recipients is not an array, and it does contain spaces then it should
try to explode the string.

2011/7/12 nickdunn <
[email protected]>

Fair enough, so long as it's in the API documentation. I raised this
because it's a breaking change (backwards), but if this is the first time
it's been raised then maybe it's not so much of a problem.

I still think the setRecipients should do some checking. If the string
contains commas or semi-colons then split, perhaps?

Reply to this email directly or view it on GitHub:
#709 (comment)

Huib Keemink
Creative Dutchmen
tel: 06-14931250
mail: [email protected]
inet: www.creativedutchmen.com
kvk: 09170619

from symphonycms.

designermonkey avatar designermonkey commented on May 26, 2024

Like I suggested.

from symphonycms.

brendo avatar brendo commented on May 26, 2024

Although spaces make sense in an email sense, it's not instantly obvious, so I'd tend to stick with comma's if we could.

from symphonycms.

nickdunn avatar nickdunn commented on May 26, 2024

I've seen UIs use all three: spaces (Apple Mail), commas (most webmail) and semicolons (Outlook), so there may be an expectation that all three are supported. PHP's mail() conforms to RFC 2822, which I haven't dared read...

from symphonycms.

brendo avatar brendo commented on May 26, 2024

But thankfully I think @michael-e and @creativedutchmen are quite well versed in it ;)

EDIT Found it:

3.6.3. Destination address fields

The destination fields of a message consist of three possible fields,
each of the same form: The field name, which is either "To", "Cc", or
"Bcc", followed by a comma-separated list of one or more addresses
(either mailbox or group syntax).

from symphonycms.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.