Skip to content

Instantly share code, notes, and snippets.

@eccyan
Last active September 6, 2018 11:57
Show Gist options
  • Save eccyan/98a4352707a689d5532f675199281e12 to your computer and use it in GitHub Desktop.
Save eccyan/98a4352707a689d5532f675199281e12 to your computer and use it in GitHub Desktop.
Fuel email driver: Save email to file
<?php
class Email_Driver_File extends \Email_Driver
{
/**
* File send: Save email to file
*
* @return bool Success boolean.
*/
protected function _send()
{
$now = time();
$message = $this->build_message();
$to = static::format_addresses($this->to);
$content = <<<TXT
To: {$to}
Subject: {$this->subject}
Header: {$message['header']}
Body: {$message['body']}
TXT
;
$hash = hash('sha256', "{$now}_{$content}");
\File::create(APPPATH.'tmp/', "{$now}_{$hash}", $content);
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment