postmark-php icon indicating copy to clipboard operation
postmark-php copied to clipboard

Feature Request: Optionally Accept Arrays for to/cc/bcc fields

Open SaintPeter opened this issue 2 years ago • 0 comments

I am in the process of converting my PHP backend from using SMPT mail to PostMark's API.

One key sticking point which is causing a lot of friction is that the to, cc, and bcc fields only accept a string with comma separated email addresses. This is in contrast to the SMTP client I was using before (and several others I'm familiar with), as well as other APIs (notably SendInBlue's API).

I propose that every function/endpoint which has a to/cc/bcc field should accept one of the following:

  1. The current status quo: a string with a comma separated list of addresses
  2. A flat array of email addresses, IE:
$to = [ '[email protected]', '[email protected]'];
  1. A nested array of display name/email pairs, IE:
$to = [ 
  [ 'Bob Jones', '[email protected]' ],
  [ 'Joe Bobson', '[email protected]' ]
];

While this does add a bit of overhead to processing these addresses, it more closely aligns with the way multiple addresses are generally used in the real world.

SaintPeter avatar Jun 24 '22 20:06 SaintPeter