Skip to main content
Version: Fegg 5.x (next)

Mail::setDebugFlag

Set debug flag and log file name

Description​

public self Mail::setDebugFlag( boolean $is_debug, string $log_name )

When $is_debug is true, Mail::send does not send the email but writes the whole message to $log_name.

Arguments​

NameData typeDefaultRemarks
$is_debugbooleantrue: write a log instead of sending
$log_namestringLog file path

Example​

Controller
use Fegg\Tool\Mail;

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

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