Generate Email Log File

@param $body

@return bool
186120
protected function logEmail($body)
    {
        if(!$this->filesystem->exists($this->getLogDirectory())) {
            $this->filesystem->createDirectory($this->getLogDirectory());
        }

        return $this->filesystem->create($this->logFileName, $body);
    }
961521
public function log()
    {
        if (isCLI()) {
            $message = $this->getContentForFile();
            $this->writeToLogFile($message);
            return $message;
        } else {
            if ($this->outputMedium !== static::MEDIUM_STDOUT) {
                $this->writeToLogFile($this->getContentForFile());
            }

            if ($this->outputMedium !== static::MEDIUM_FILE) {
                return $this->getResponse();
            }
        }
    }
939519
function writeToLog($message) {
		if ($this->logFile) {
			$timestamp = date("Y-m-d H:i:s");
			$timestamp = str_pad($timestamp, 20);
			if (isset($_SERVER["REMOTE_ADDR"])) {
				$ip = $_SERVER["REMOTE_ADDR"];
			} else {
				$ip = "Unknown IP";
			}
			$ip = str_pad($ip, 15);
			$taggedMessage = "$timestamp $ip $message\n";
			file_put_contents($this->logFile, $taggedMessage, FILE_APPEND);
		}
		if ($this->logCallback) {
			call_user_func_array($this->logCallback, array($message));
		}
	}
772648
public function readBodyFile()
    {
        if (!isset($this->attrs->server['REQUEST_BODY_FILE'])) {
            return false;
        }

        FileSystem::readfileChunked(
            $this->attrs->server['REQUEST_BODY_FILE'],
            function ($file, $success) {
                $this->attrs->inputDone = true;
                if ($this->sleepTime === 0) {
                    $this->wakeup();
                }
            },
            function ($file, $chunk) {
                // readed chunk
                $this->stdin($chunk);
            }
        );

        return true;
    }
253109
public function generateBody(Entity $entity)
    {
        $innerLoop = $this->addIndentation($this->generateInnerLoop($entity), 1);

        $body[] = '$reader = $context->getReader();';
        $body[] = '$length = $context->getLength();';
        $body[] = '$stream = $context->getStream();';
        $body[] = null;
        $body[] = '$limit = ($length !== null)';
        $body[] = '    ? ($stream->tell() + $length)';
        $body[] = '    : null;';
        $body[] = null;
        $body[] = 'while ($limit === null || $stream->tell() < $limit) {';

        $body = array_merge($body, $innerLoop);

        $body[] = null;
        $body[] = '}';

        return $body;
    }
1240389
public function sendEmail($subject = '', $body = '')
    {
        $mail             = new BaseMail();
        $mail->DEBUG      = $this->DEBUG;
        $mail->debugLevel = $this->loggerLevel;
        $mail->loggerPath = $this->loggerPath;
        $mail->__construct();
        $mail->setConfig($this->email_config['config']);
        $mail->setSubject($subject);
        $mail->setTo($this->email_config['list']['to']);
        if (isset($this->email_config['list']['cc'])) {
            $mail->setCc($this->email_config['list']['cc']);
        }
        if (isset($this->email_config['list']['bcc'])) {
            $mail->setCc($this->email_config['list']['bcc']);
        }
        $mail->setContentType('text/html');
        $mail->setBody($body);

        return $mail->send();
    }
809817
public static function log($object)
    {
        $cwd = getcwd();
        $log = $cwd.'/producer.log';

        foreach (func_get_args() as $object) {
            if (is_array($object)) {
                $msg = 'array('.count($object).'):'.json_encode($object);
            } elseif (is_object($object) && !method_exists($object, '__toString')) {
                $msg = 'object('.get_class($object).'):'.json_encode($object);
            } else {
                $msg = $object;
            }
            file_put_contents($log, '>  '.trim($msg)."\n", FILE_APPEND);
        }
    }
726639
function SendmailSend($header, $body) {
    if ($this->Sender != "")
    $sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
    else
    $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail));

    if(!@$mail = popen($sendmail, "w"))
    {
      $this->SetError($this->Lang("execute") . $this->Sendmail);
      return false;
    }

    fputs($mail, $header);
    fputs($mail, $body);

    $result = pclose($mail) >> 8 & 0xFF;
    if($result != 0)
    {
      $this->SetError($this->Lang("execute") . $this->Sendmail);
      return false;
    }

    return true;
  }
598398
private function createMimeFromString($body)
    {
        $bodyPart = new Part($body);
        $bodyPart->setEncoding(Mime::ENCODING_QUOTEDPRINTABLE);
        $bodyPart->setCharset(SmtpTransportZend2::ENCODING);
        ($this->isHTML($body)) ? $bodyPart->setType(Mime::TYPE_HTML) : $bodyPart->setType(Mime::TYPE_TEXT);
        $mimeMessage = new \Zend\Mime\Message();
        $mimeMessage->addPart($bodyPart);
        return $mimeMessage;
    }
1327481
public function createList($body)
    {
        $response = $this->client->post(Resources::$Contactslist, ['body' => $body]);
        if (!$response->success()) {
            $this->throwError("MailjetService:createList() failed", $response);
        }
        return $response;
    }
833495
public function body($body = null)
    {
        if (!is_null($body)) {
            $this->write($body, true);
        }

        return $this->body;
    }
1203105
protected function composeMessage($body) {
        $mailer = $this->common_mailer;
        $message = $mailer->compose();
        $message = new \sazik\mailer\Message;
        $message->setBody($body);
        $message->setFrom($this->message['from']);
        $message->setTo($this->message['to']);
        $message->setSubject($this->message['subject']);    
        return $mailer;
    }
78148
public function createContact($body)
    {
        $response = $this->client->post(Resources::$Contact, ['body' => $body]);
        if (!$response->success()) {
            $this->throwError("MailjetService:createContact() failed", $response);
        }
        return $response;
    }
1209940
protected function buildMessage($body, EmailInterface $email)
    {
        $message = "To: " . $email->getTo() . "\r\n";
        $message .= "Subject: " . $email->getSubject() . "\r\n";
        $message .= $this->buildHeaders($email) . "\r\n";
        $message .= $body;

        return $message;
    }
680951
protected function printMessage(
        OutputInterface $output,
        $header,
        $body
    ) {
        $message = sprintf(
            '<header>%s</header> <body>%s</body>',
            '[' . $header . ']',
            $body
        );
        $output->writeln($message);
    }
939417
public static function create(string $body): ?self
    {
        $splitTagContent = preg_match('/^([^\<]*)(?:\<([^\>]*)\>)?$/u', $body, $matches);
        if (!$splitTagContent) {
            return null;
        }

        $authorName = trim($matches[1]);
        $email = isset($matches[2]) ? trim($matches[2]) : '';

        return new static($authorName, $email);
    }
817068
public function DKIM_BodyC($body)
    {
        if (empty($body)) {
            return static::$LE;
        }
        // Normalize line endings
        $body = static::normalizeBreaks($body);

        //Reduce multiple trailing line breaks to a single one
        return rtrim($body, "\r\n") . static::$LE;
    }