Skip to content

Commit

Permalink
Use constansts (#167)
Browse files Browse the repository at this point in the history
* Use constansts

`MAILGUN_TRACK_CLICKS`
`MAILGUN_TRACK_OPENS`

for forcing settings on the backend

* Use constansts

`MAILGUN_TRACK_CLICKS`
`MAILGUN_TRACK_OPENS`

for forcing settings on the backend
  • Loading branch information
oleksandr-mykhailenko authored Jun 21, 2023
1 parent 7c09945 commit b798984
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
14 changes: 12 additions & 2 deletions includes/wp-mail-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,18 @@ function wp_mail($to, $subject, $message, $headers = '', $attachments = [])
}

$body['o:tag'] = [];
$body['o:tracking-clicks'] = !empty($mailgun['track-clicks']) ? $mailgun['track-clicks'] : 'no';
$body['o:tracking-opens'] = empty($mailgun['track-opens']) ? 'no' : 'yes';
if (defined('MAILGUN_TRACK_CLICKS')) {
$trackClicks = MAILGUN_TRACK_CLICKS;
} else {
$trackClicks = !empty($mailgun['track-clicks']) ? $mailgun['track-clicks'] : 'no';
}
if (defined('MAILGUN_TRACK_OPENS')) {
$trackOpens = MAILGUN_TRACK_OPENS;
} else {
$trackOpens = empty($mailgun['track-opens']) ? 'no' : 'yes';
}
$body['o:tracking-clicks'] = $trackClicks;
$body['o:tracking-opens'] = $trackOpens;

// this is the wordpress site tag
if (isset($mailgun['tag'])) {
Expand Down
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ MAILGUN_SECURE Type: boolean Choices: '0' or '1' (0 = false/no)
MAILGUN_SECTYPE Type: string Choices: 'ssl' or 'tls'
MAILGUN_FROM_NAME Type: string
MAILGUN_FROM_ADDRESS Type: string
MAILGUN_TRACK_CLICKS Type: string Choices: 'yes' or 'no'
MAILGUN_TRACK_OPENS Type: string Choices: 'yes' or 'no'
```

- What hooks are available for use with other plugins?
Expand Down
2 changes: 2 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ MAILGUN_SECURE Type: boolean Choices: '0' or '1' (0 = false/no)
MAILGUN_SECTYPE Type: string Choices: 'ssl' or 'tls'
MAILGUN_FROM_NAME Type: string
MAILGUN_FROM_ADDRESS Type: string
MAILGUN_TRACK_CLICKS Type: string Choices: 'yes' or 'no'
MAILGUN_TRACK_OPENS Type: string Choices: 'yes' or 'no'
`

- What hooks are available for use with other plugins?
Expand Down

0 comments on commit b798984

Please sign in to comment.