本文整理汇总了PHP中Illuminate\Mail\Message::getSwiftMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::getSwiftMessage方法的具体用法?PHP Message::getSwiftMessage怎么用?PHP Message::getSwiftMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Mail\Message
的用法示例。
在下文中一共展示了Message::getSwiftMessage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetAttachments
public function testGetAttachments()
{
$getAttachment = \Closure::bind(function ($message) {
return $this->getAttachments($message);
}, $this->transport, 'Sichikawa\\LaravelSendgridDriver\\Transport\\SendgridTransport');
$message = new Message($this->getMessage());
$file = __DIR__ . '/test.png';
$message->attach($file);
$res = $getAttachment($message->getSwiftMessage());
$this->assertEquals(base64_encode(file_get_contents($file)), array_get($res, '0.content'));
$this->assertEquals('test.png', array_get($res, '0.filename'));
}
示例2: runCallbacks
/**
* Run the callbacks for the message.
*
* @param \Illuminate\Mail\Message $message
* @return $this
*/
protected function runCallbacks($message)
{
foreach ($this->callbacks as $callback) {
$callback($message->getSwiftMessage());
}
return $this;
}
示例3: addContent
/**
* Add the content to a given message.
*
* @param \Illuminate\Mail\Message $message
* @param string $view
* @param string $plain
* @param array $data
* @return void
*/
protected function addContent($message, $view, $plain, $raw, $data)
{
/*
* Extensibility
*/
if ($this->fireEvent('mailer.beforeAddContent', [$message, $view, $data], true) === false || Event::fire('mailer.beforeAddContent', [$this, $message, $view, $data], true) === false) {
return;
}
$html = null;
$text = null;
if (isset($view)) {
$viewContent = $this->getView($view, $data);
$result = MailParser::parse($viewContent);
$html = $result['html'];
if ($result['text']) {
$text = $result['text'];
}
/*
* Subject
*/
$customSubject = $message->getSwiftMessage()->getSubject();
if (empty($customSubject) && ($subject = array_get($result['settings'], 'subject'))) {
$message->subject($subject);
}
}
if (isset($plain)) {
$text = $this->getView($plain, $data);
}
if (isset($raw)) {
$text = $raw;
}
$this->addContentRaw($message, $html, $text);
/*
* Extensibility
*/
$this->fireEvent('mailer.addContent', [$message, $view, $data]);
Event::fire('mailer.addContent', [$this, $message, $view, $data]);
}
示例4: testSetSmtpApi
public function testSetSmtpApi()
{
$setSmtpApi = \Closure::bind(function (&$data, $message) {
return $this->setSmtpApi($data, $message);
}, $this->transport, 'Sichikawa\\LaravelSendgridDriver\\Transport\\SendGridTransport');
$data = [];
$message = new Message($this->getMessage());
$message->embedData(['category' => 'foo'], 'sendgrid/x-smtpapi');
$setSmtpApi($data, $message->getSwiftMessage());
$this->assertEquals(json_encode(['category' => 'foo']), $data['x-smtpapi']);
}
示例5: testGetSwiftMessageMethod
public function testGetSwiftMessageMethod()
{
$this->assertInstanceOf(Swift_Mime_Message::class, $this->message->getSwiftMessage());
}
示例6: testSetPersonalizations
public function testSetPersonalizations()
{
$setParameters = \Closure::bind(function ($message, $data) {
return $this->setParameters($message, $data);
}, $this->transport, SendgridV3Transport::class);
$personalizations = [['substitutions' => ['substitutions_key' => 'substitutions_value'], 'custom_args' => ['custom_args_key' => 'custom_args_value'], 'send_at' => time()]];
$message = new Message($this->getMessage());
$message->embedData(['personalizations' => $personalizations], 'sendgrid/x-smtpapi');
$data = [];
$data = $setParameters($message->getSwiftMessage(), $data);
$this->assertEquals(['personalizations' => $personalizations], $data);
}