Pop\Mail\Mail::sendFrom PHP 메소드

sendFrom() 공개 메소드

This method depends on the server being set up correctly as an SMTP server and sendmail being correctly defined in the php.ini file.
public sendFrom ( string $from = null, boolean $delete = false ) : Mail
$from string
$delete boolean
리턴 Mail
    public function sendFrom($from = null, $delete = false)
    {
        $dir = null !== $from ? $from : getcwd();
        $emailDir = new \Pop\File\Dir($dir, true);
        $emailFiles = $emailDir->getFiles();
        if (isset($emailFiles[0])) {
            foreach ($emailFiles as $email) {
                if (file_exists($email)) {
                    // Get the email data from the contents
                    $emailData = $this->getEmailFromFile($email);
                    // Send the email message.
                    mail($emailData['to'], $emailData['subject'], $emailData['message'], $emailData['headers'], $this->params);
                    // Delete the email file is the flag is passed
                    if ($delete) {
                        unlink($email);
                    }
                }
            }
        }
        return $this;
    }