Skip to content
This repository was archived by the owner on Dec 22, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/Mail/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function send($view, array $data, Closure $callback, $message = null)
$message = $this->message->getMessage();
$files = $this->message->getFiles();

$domain = $this->config->get('mailgun.domain');
$domain = $this->message->getDomain();
$response = new Response($this->mailgun->post("{$domain}/messages", $message, $files));

return $response;
Expand Down
29 changes: 29 additions & 0 deletions src/Mail/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ class Message
*/
protected $variables = [];

/**
* @var string|null
*/
protected $domain = null;

/**
* Message constructor.
*
Expand Down Expand Up @@ -281,6 +286,30 @@ public function testmode($enabled = true)
return $this;
}

/**
* Override the default Mailgun domain with another domain name registered with Mailgun.
*
* @param string $domain
*
* @return void
*/
public function domain($domain)
{
$this->domain = $domain;

return $this;
}

/**
* Returns the domain name to use to send the message
*
* @return string
*/
public function getDomain()
{
return $this->domain !== null ? $this->domain : $this->config->get('mailgun.domain');
}

/**
* Append a custom MIME header to a message.
*
Expand Down