8000 [9.x] ability to add tags/metadata to Emails/Notifications by kbond · Pull Request #40783 · laravel/framework · GitHub
[go: up one dir, main page]

Skip to content

[9.x] ability to add tags/metadata to Emails/Notifications #40783

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 4, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
formatting
  • Loading branch information
taylorotwell committed Feb 4, 2022
commit d1f8f9460ddfdba0623429d4d035800f2d2df9e7
54 changes: 27 additions & 27 deletions src/Illuminate/Notifications/Messages/MailMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,33 @@ public function attachData($data, $name, array $options = [])
return $this;
}

/**
* Add a tag header to the message when supported by the underlying transport.
*
* @param string $value
* @return $this
*/
public function tag($value)
{
return $this->withSymfonyMessage(function (Email $message) use ($value) {
$message->getHeaders()->add(new TagHeader($value));
});
}

/**
* Add a metadata header to the message when supported by the underlying transport.
*
* @param string $key
* @param string $value
* @return $this
*/
public function metadata($key, $value)
{
return $this->withSymfonyMessage(function (Email $message) use ($key, $value) {
$message->getHeaders()->add(new MetadataHeader($key, $value));
});
}

/**
* Set the priority of this message.
*
Expand Down Expand Up @@ -324,33 +351,6 @@ public function render()
->render($this->markdown, $this->data());
}

/**
* Add a tag to the email (for drivers that support).
*
* @param string $value
* @return $this
*/
public function tag($value)
{
return $this->withSymfonyMessage(function (Email $message) use ($value) {
$message->getHeaders()->add(new TagHeader($value));
});
}

/**
* Add metadata to the email (for drivers that support).
*
* @param string $key
* @param string $value
* @return $this
*/
public function metadata($key, $value)
{
return $this->withSymfonyMessage(function (Email $message) use ($key, $value) {
$message->getHeaders()->add(new MetadataHeader($key, $value));
});
}

/**
* Register a callback to be called with the Symfony message instance.
*
Expand Down
0