Skip to content

Commit

Permalink
Merge pull request #50 from bakura10/mandrill-fix
Browse files Browse the repository at this point in the history
Allow non template Mandrill messages to have variables
  • Loading branch information
Jurian Sluiman committed Sep 10, 2013
2 parents a792ddf + cb602b7 commit 787f5df
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 1.1.1

- Allow non-template Mandrill messages to have merge variables

## 1.1.0

- Add support for Mandrill subaccounts API
Expand Down
34 changes: 17 additions & 17 deletions src/SlmMail/Service/MandrillService.php
Original file line number Diff line number Diff line change
Expand Up @@ -771,29 +771,29 @@ private function parseMessage(Message $message, $isTemplate)
if (!isset($parameters['template_content'])) {
$parameters['template_content'] = array();
}
}

foreach ($message->getGlobalVariables() as $key => $value) {
$parameters['message']['global_merge_vars'][] = array(
'name' => $key,
'content' => $value
);
}

foreach ($message->getVariables() as $recipient => $variables) {
$recipientVariables = array();

foreach ($message->getGlobalVariables() as $key => $value) {
$parameters['message']['global_merge_vars'][] = array(
foreach ($variables as $key => $value) {
$recipientVariables[] = array(
'name' => $key,
'content' => $value
);
}

foreach ($message->getVariables() as $recipient => $variables) {
$recipientVariables = array();

foreach ($variables as $key => $value) {
$recipientVariables[] = array(
'name' => $key,
'content' => $value
);
}

$parameters['message']['merge_vars'][] = array(
'rcpt' => $recipient,
'vars' => $recipientVariables
);
}
$parameters['message']['merge_vars'][] = array(
'rcpt' => $recipient,
'vars' => $recipientVariables
);
}

foreach ($message->getOptions() as $key => $value) {
Expand Down
2 changes: 1 addition & 1 deletion src/SlmMail/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@

class Version
{
const VERSION = '1.1.0';
const VERSION = '1.1.1';
}

0 comments on commit 787f5df

Please sign in to comment.