メインコンテンツまでスキップ
Version: Fegg 5.x

Mail::setDebugFlag

メールを送信せずにログファイルに書き込みます

説明​

public self Mail::setDebugFlag( boolean $is_debug, [ string $log_name = null ] )

$is_debugがtrueのとき、Mail::sendはメールを送らず、メッセージ全体をログファイルに書き込みます。ログファイルは$log_name、指定がなければログディレクトリのmail.log(htdocs/_fegg/site/data/log/mail.log、またはFEGG_LOG_DIRのディレクトリ)です。使うファイルはMail::logFileで取得できます。

引数​

名前データ型デフォルト備考
$is_debugbooleantrueにすると、送信せずにログを書き込みます
$log_namestringnullログファイルのパス(省略するとログディレクトリのmail.log)

例​

Controller
use Fegg\Tool\Mail;

$mail = new Mail('Mail subject', 'Mail body');
$mail->setDebugFlag(true); // site/data/log/mail.log
$mail->setDebugFlag(true, FEGG_SITE_DIR . '/data/log/contact_admin.log'); // another file

// Written to the log file instead of being sent
$mail->send('mail@example.com', 'John Doe', 'from@example.com');