'title' => $title,
'body' => $body,
'subject' => $subject,
+ 'headers' => $emailBuilder->getHeaders(),
];
Hook::callAll('enotify_mail', $datarray);
- $builder = DI::emailer()
- ->newNotifyMail()
- ->addHeaders($datarray['headers'])
+ $emailBuilder
+ ->withHeaders($datarray['headers'])
->withRecipient($params['to_email'])
->forUser([
'uid' => $datarray['uid'],
return $this;
}
+ /**
+ * Returns the current headers
+ *
+ * @return string[][]
+ */
+ public function getHeaders()
+ {
+ return $this->headers;
+ }
+
+ /**
+ * Sets the headers
+ *
+ * Expected format is
+ * [
+ * 'Header1' => ['value1', 'value2', ...],
+ * 'Header2' => ['value3', 'value4', ...],
+ * ...
+ * ]
+ *
+ * @param string[][] $headers
+ * @return $this
+ */
+ public function withHeaders(array $headers)
+ {
+ $this->headers = $headers;
+
+ return $this;
+ }
+
/**
* Adds a value to a header
*