Last active
September 6, 2018 11:57
-
-
Save eccyan/98a4352707a689d5532f675199281e12 to your computer and use it in GitHub Desktop.
Fuel email driver: Save email to file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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