I have been trying to send email to my contacts with their name last name and first name order. I mean "To: last_name first_name [email protected]"

I have already changed the Display Preference to {contact.last_name}{ }{contact.first_name} from the Administrator menu. It works fine for the display and also for CKEditor's to field. It is properly shown as last_name first_name order as I wanted.

But when I send an email, email comes with the name by the different order, I mean "To: first_name last_name [email protected]", which is not suitable in East Asia. The email header is quite essential to keep our relationships with our contacts.

I tried to find a way to change it but in vain.

Could someone help me how to solve this? Thank you in advance.

1 Answer 1


It seems to be hardcoded at https://github.com/civicrm/civicrm-core/blob/cb21080b397be5f8b84bca2c6d3483ad64d7071f/CRM/Contact/BAO/Contact.php#L1934

$name = "{$dao->first_name} {$dao->last_name}";

I don't see an obvious reason why it's hardcoded, but the function is used in a couple places - maybe there are some places where it was needed to have a "short version" of the display name.

  • Thank you very much. I could change the order. I can now send emails by the East Asian style. This is quite important for us.
    – Chitose
    Commented May 7, 2022 at 13:26
  • I'm assuming CiviCRM is not using the display name because prefixes in email can be awkward, but I tend to always remove prefixes. Do we need a new setting? Seems important here.
    – bgm
    Commented Jun 8, 2022 at 13:13
  • There is a token {contact.email_greeting} which should work for you - that is configurable per user & also has it's own template - like display name
    – eileen
    Commented Jun 8, 2022 at 20:47
  • But that won't change the "To" in the email headers. Or are you saying to replace the hardcoding in the code with the token? But it usually contains "Dear" in it.
    – Demerit
    Commented Jun 8, 2022 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.