Call to undefined function Zend\Mail\Header\iconv_mime_decode()
Unreality1987 opened this issue · 1 comments
Unreality1987 commented
I use zend-mail to send an register mail through SMTP with TLS and plain auth.
Here is the used code:
<?php
namespace App\Mail\Service;
use Zend\Mail\Transport\Smtp;
use Zend\Mail\Transport\SmtpOptions;
use Zend\Mail\Message;
class MailService
{
private $transport;
private $options;
public function __construct() {
$this->transport = new Smtp();
$this->options = new SmtpOptions([
'name' => 'XXXXXX',
'host' => 'XXXXXX',
'port' => 587,
'connection_class' => 'plain',
'connection_config' => [
'username' => 'XXXXXX',
'password' => 'XXXXXX',
'ssl' => 'tls'
],
]);
$this->transport->setOptions($this->options);
}
public function sendRegisterMail($email)
{
$message = new Message();
$message->addFrom('XXXXXX', 'XXXXXX');
$message->addTo($email);
$message->setEncoding("UTF-8");
$message->getHeaders()->addHeaderLine('Content-Type', 'text/plain; charset=UTF-8');
$message->setSubject('Subject');
$message->setBody('This is the Message Body');
$this->transport->send($message);
}
}
?>
When I'm calling this function the above error message appears. ICONV is installed and working, even NetBeans 8.2 recognizes the function in autocomplete. So I have no idea why this error occurs.
Regards,
Unreality
Unreality1987 commented
Although iconv seemed to be enabled, it wasn't in php.ini