Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7636903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:48:11+00:00 2026-05-31T07:48:11+00:00

How to set characterset to UTF-8 that affects the subject of mail function with

  • 0

How to set characterset to UTF-8 that affects the subject of mail function with attachment,
Massive headache i’m getting,

i’m using this to send a french content (subject + body) + attached file.
The characters on teh body are okay and display well accented, but the accented chars on the subject are just a mess.

I’m getting the data via POST (except the attached file, allready has defined path on the server).

$email_from = "$Emp->Email";
$email_subject = $_POST['email_subject_posted'];
$email_message = "Nom: $Emp->Nom<br>";
$email_message .= "Prénom: $Emp->Prenom<br>";   
$email_message .= "Tel: $Emp->Mobile<br>";
$email_message .= "Email: $Emp->Email<br><br>";

$email_message .= stripslashes(strip_tags($lettre));
$email_message .= "<br><br>";
$email_message .= "Candidature envoyée avec mon compte Example.<br>";
$email_message .= "http://www.example.org<br>";
$email_message .= "1er Site de l’emploi en Algérie.";

$email_to = "$email_candidature";
$headers = "From: ".$email_from;
$file = fopen($CVfile,'rb');
$data = fread($file,filesize($CVfile));
fclose($file);
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
$email_message .= "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type:text/html; charset=\"utf-8\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$email_message .= "\n\n";

$data = chunk_split(base64_encode($data));

$email_message .= "--{$mime_boundary}\n" .
"Content-Type: {$CVfile_type};\n" .
" name=\"{$CVfile_name}\"\n" .
//"Content-Disposition: attachment;\n" .
//" filename=\"{$CVfile_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data .= "\n\n" .
"--{$mime_boundary}--\n";

$ok = @mail($email_to, $email_subject, $email_message, $headers);

Any input is too much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T07:48:12+00:00Added an answer on May 31, 2026 at 7:48 am

    I had such a problem when my PHP file encoding wasn’t similar to message encoding. Check the encoding of your PHP file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking into how characters are handled that are outside of the set characterset
What is the reason, that using CONCAT() in pure UTF-8 environment MySQL still treats
I have a MySQL table using the UTF-8 character set with a single column
The mysql manual says that SET NAMES 'x' is equivalent to SET character_set_client =
This is my c++ struct (Use Multi-Byte Character Set) typedef struct hookCONFIG { int
I have a simple html form that submits information with POST function. But when
What can I do to ensure that replication will use latin1 instead of utf-8?
I have a MySQL table properly set to the UTF-8 character set. I suspect
UTF-8 is an encoding used to represent the Unicode Character set . Other encodings
Is there an i18n shell in windows that supports a large character set? Testing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.