Answer the question
In order to leave comments, you need to log in
Why does PHPMailer require more than 1Gb of memory?
I'm trying to send emails via PHPMailer (PHP7 runs php-fpm under FreeBSD), code:
function mailSend ($addresses, $subject, $message)
{
try {
$mail = new PHPMailer;
$mail->SMTPDebug = 3;
$mail->setLanguage('ru', __DIR__ . '/PHPMailer/language/phpmailer.lang-ru.php');
$mail->CharSet = MAIL_CHARSET;
$mail->isSMTP();
$mail->Host = MAIL_HOST;
$mail->SMTPAuth = true;
$mail->Username = MAIL_USERNAME;
$mail->Password = MAIL_PASSWORD;
$mail->SMTPSecure = 'ssl';
$mail->Port = MAIL_PORT;
$mail->From = MAIL_FROM;
$mail->FromName = MAIL_FROM_NAME;
$mail->addAddress($addresses);
$mail->addReplyTo(MAIL_REPLYTO_ADDRESS, MAIL_REPLYTO_NAME);
$mail->WordWrap = 50;
//$mail->addAttachment('/var/tmp/file.tar.gz');
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg');
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = $message;
if (!$mail->send()) {
echo 'false';
} else {
echo 'true';
}
}
catch (Exception $e)
{
echo $e->getMessage();
}
}
mailSend('[email protected]', 'test', 'test');
Answer the question
In order to leave comments, you need to log in
I work with it under php5.6 on a server with 512 RAM, everything is fine. I think it's in php-fpm or in php7, put xhprof, see which part is eating up all the memory
If anyone needs it...
Solved the problem for now by commenting out this:
$sock_status = stream_get_meta_data($this->smtp_conn);
if ($sock_status['eof']) {
// The socket is valid but we are not connected
$this->edebug(
'SMTP NOTICE: EOF caught while checking if connected',
self::DEBUG_CLIENT
);
$this->close();
return false;
}
$info = stream_get_meta_data($this->smtp_conn);
if ($info['timed_out']) {
$this->edebug(
'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)',
self::DEBUG_LOWLEVEL
);
break;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question