I am using Mandrill to send mails to our members.
Sending a normal text message works perfect.
But a message with special characters (ä,ë,ï,ö,ü,€,...) will not be attached in Mandrill's 'html' =>
variable.
Can anyone tell me how to send a message with special characters through Mandrill?
I tried to edit the $message_content
variable with str_replace
and preg_replace
, none worked so far.
When I use ï
and €
when typing the message content, it works perfect. But I can't seem to change this when the submit button is pressed.
this is my code:
<?
if(isset($_POST['submit']) {
$subject = $_POST['subject'];
$from_name = $_POST['from_name'];
$from_email = $_POST['from_email'];
$message_content = nl2br($_POST['message_content']);
$mail_to_members = array();
$mail_to_members[] = array('email' => 'name@domain.com');
$mail_to_members[] = array('email' => 'name@domain.com');
//Get Mandrill API
require_once './include/src/Mandrill.php';
$mandrill = new Mandrill('API-key');
//Create mail
$message = array(
'subject' => $subject,
'from_name' => $from_name,
'from_email' => $from_email,
'html' => $message_content,
'to' => $mail_to_members,
);
$mandrill->messages->send($message);
}
?>