I am using php mail function to send an email with a pdf attachment, but its name which is written in greek does not show correctly. I have tried many different things but nothing worked.
require_once "/usr/share/pear/Mail.php";
require_once "/usr/share/pear/Mail/mime.php";
$filename= "ΤΠΥ ΗΛ ΚΛΠ greek chars.pdf";
$mailBody = 'lorem ipsum blah blah';
$from = 'test@test.gr';
$to = 'test2@test2.gr';
//email settings from database (it is working correctly)
$smtp = Mail::factory('smtp',array ('host' => $emailSettings['host'],'port'=> $emailSettings['port'],'auth' => $auth,'username' => $emailSettings['username'],'password' => $emailSettings['password']));
$hdrs = array ('From' => $from,
'To' => $to,
'Subject' => $emailMessages['subject'],
'Content-Type' => 'text/html; charset=UTF-8');
$mime_params = array(
'text_encoding' => '7bit',
'text_charset' => 'utf-8',
'html_charset' => 'utf-8',
'head_charset' => 'utf-8'
);
$mime = new Mail_mime();
$mime->setHTMLBody($mailBody);
$mime->addAttachment($filename, 'application/pdf');
$body = $mime->get($mime_params);
$hdrs = $mime->headers($hdrs);
$mail = $smtp->send($to, $hdrs, $body);
The result I get is ΤÎ%c2 greek chars.pdf. Could anyone figure out what is wrong