Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Encoding problem with email subject line

Go to End

2 Posts   2527 Views


Community Member, 75 Posts

7 March 2009 at 6:53am

Hi! Does anybody knows about the email function and the encoding problem?

I've got a problem with the encoding of the subject line of my send emails.

It's possible to send an email in utf-8. The body of the email is correctly encoded.
But it's not working for the "subject" header of the email. I'm receiving broken encoding.

Something might be wrong with the email header.

Any idea?


Community Member, 4 Posts

11 January 2010 at 11:20pm

Dear all,

I am having the same issue. I don't understand which encoding to use to send email subjects from Silverstripe.

As a temporary measure, I use the following function to remove most common French characters, but I would like to know how to proceed.

Warm regards,


function removeAccents($remove_from)
// Remove all instances of accents
$accent_array = array('e' => array('é','è','ê','ë'),
'E' => array('É','È','Ê','Ë'),
'a' => array('á','à','â','ä','å'),
'A' => array('Á','À','Â','Ä','Å'),
'i' => array('ï','ì','î'),
'I' => array('Ï','Ì','Î'),
'o' => array('ö','ô','ò'),
'O' => array('Ö','Ô','Ò'),
'u' => array('ü','û','ù'),
'U' => array('Ü','Û','Ù')
foreach($accent_array as $acc_key => $acc_val_array)
$reg_exp_accent = '';// clear regular expression var
$reg_exp_accent .= $acc_val_array[$m].'|';// create the regular expression var
$reg_exp_accent = substr_replace($reg_exp_accent,"",-1);// remove last '|'

$remove_from = ereg_replace($reg_exp_accent,$acc_key,$remove_from);
return $remove_from;