Skip to content

Commit 41c6833

Browse files
committed
feature #57424 [Mailer] [Infobip] Add trackClicks, trackOpens and trackingUrl as supp… (ndousson)
This PR was merged into the 7.2 branch. Discussion ---------- [Mailer] [Infobip] Add trackClicks, trackOpens and trackingUrl as supp… | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | yes | Deprecations? | no | License | MIT | Doc PR | symfony/symfony-docs#xxxxxxxx # TODO # 📍 Context This PR add three headers to configure Infobip email tracking with API V3. # ➕ New feature New payload attribute was added allowing end users to configure tracking. | Attribute | Type | Description | | --- | --- | --- | | X-Infobip-TrackingUrl | string | The URL on your callback server on which the open and click notifications will be sent. | | X-Infobip-TrackClicks | boolean | Enable or disable track click feature. | | X-Infobip-TrackOpens | boolean | Enable or disable open click feature. | Commits ------- add289e [Mailer][Infobip] Add trackClicks, trackOpens and trackingUrl as supported payload properties
2 parents 916718c + add289e commit 41c6833

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed

src/Symfony/Component/Mailer/Bridge/Infobip/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
7.2
5+
---
6+
7+
* Add support of trackClicks, trackOpens and trackingUrl payload properties
8+
49
6.3
510
---
611

src/Symfony/Component/Mailer/Bridge/Infobip/Tests/Transport/InfobipApiTransportTest.php

+36-2
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,11 @@ public function testSendEmailWithHeadersShouldCalledInfobipWithTheRightParameter
248248
->addTextHeader('X-Infobip-IntermediateReport', 'true')
249249
->addTextHeader('X-Infobip-NotifyUrl', 'https://foo.bar')
250250
->addTextHeader('X-Infobip-NotifyContentType', 'application/json')
251-
->addTextHeader('X-Infobip-MessageId', 'RANDOM-CUSTOM-ID');
251+
->addTextHeader('X-Infobip-MessageId', 'RANDOM-CUSTOM-ID')
252+
->addTextHeader('X-Infobip-Track', 'false')
253+
->addTextHeader('X-Infobip-TrackingUrl', 'https://bar.foo')
254+
->addTextHeader('X-Infobip-TrackClicks', 'true')
255+
->addTextHeader('X-Infobip-TrackOpens', 'true');
252256

253257
$this->transport->send($email);
254258

@@ -280,6 +284,30 @@ public function testSendEmailWithHeadersShouldCalledInfobipWithTheRightParameter
280284
Content-Disposition: form-data; name="messageId"
281285
282286
RANDOM-CUSTOM-ID
287+
--%s
288+
Content-Type: text/plain; charset=utf-8
289+
Content-Transfer-Encoding: 8bit
290+
Content-Disposition: form-data; name="track"
291+
292+
false
293+
--%s
294+
Content-Type: text/plain; charset=utf-8
295+
Content-Transfer-Encoding: 8bit
296+
Content-Disposition: form-data; name="trackingUrl"
297+
298+
https://bar.foo
299+
--%s
300+
Content-Type: text/plain; charset=utf-8
301+
Content-Transfer-Encoding: 8bit
302+
Content-Disposition: form-data; name="trackClicks"
303+
304+
true
305+
--%s
306+
Content-Type: text/plain; charset=utf-8
307+
Content-Transfer-Encoding: 8bit
308+
Content-Disposition: form-data; name="trackOpens"
309+
310+
true
283311
--%s--
284312
TXT,
285313
$options['body']
@@ -410,7 +438,10 @@ public function testSendEmailWithHeadersWithSuccess()
410438
->addTextHeader('X-Infobip-NotifyUrl', 'https://foo.bar')
411439
->addTextHeader('X-Infobip-NotifyContentType', 'application/json')
412440
->addTextHeader('X-Infobip-MessageId', 'RANDOM-CUSTOM-ID')
413-
->addTextHeader('X-Infobip-Track', 'false');
441+
->addTextHeader('X-Infobip-Track', 'false')
442+
->addTextHeader('X-Infobip-TrackingUrl', 'https://bar.foo')
443+
->addTextHeader('X-Infobip-TrackClicks', 'true')
444+
->addTextHeader('X-Infobip-TrackOpens', 'true');
414445

415446
$sentMessage = $this->transport->send($email);
416447

@@ -423,6 +454,9 @@ public function testSendEmailWithHeadersWithSuccess()
423454
X-Infobip-NotifyContentType: application/json
424455
X-Infobip-MessageId: RANDOM-CUSTOM-ID
425456
X-Infobip-Track: false
457+
X-Infobip-TrackingUrl: https://bar.foo
458+
X-Infobip-TrackClicks: true
459+
X-Infobip-TrackOpens: true
426460
%a
427461
TXT,
428462
$sentMessage->toString()

src/Symfony/Component/Mailer/Bridge/Infobip/Transport/InfobipApiTransport.php

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ final class InfobipApiTransport extends AbstractApiTransport
3939
'X-Infobip-NotifyContentType' => 'notifyContentType',
4040
'X-Infobip-MessageId' => 'messageId',
4141
'X-Infobip-Track' => 'track',
42+
'X-Infobip-TrackingUrl' => 'trackingUrl',
43+
'X-Infobip-TrackClicks' => 'trackClicks',
44+
'X-Infobip-TrackOpens' => 'trackOpens',
4245
];
4346

4447
public function __construct(

0 commit comments

Comments
 (0)