0

I'm using an array to send form mail. The array includes the subject of each field option in the form.

array("0",""),
array("1","Subject 1a, Text","Subject 1b","Subject 1c"),
array("2","Subject 2a","Subject 2b","Subject 2c")

When the form is delivered to the client, the subject line says "Form: Subject xx".

$subject = "Form: ".$value[1]; 

However, if the subject contains a comma as it does in the first example (i.e. "Subject 1a, Text") the form is delivered with only Form: Subject 1a in the subject field.

It doesn't send the full subject line with the comma and the words after it (i.e. Form: Subject 1a, Text).

Any thoughts on what might be going on?

user3216933
  • 275
  • 1
  • 3
  • 12

1 Answers1

1

Something like this should work

iconv_set_encoding("internal_encoding", "UTF-8");

$subject = "Testmail — Special Characters";
$msg = "Hi there,\n\nthis isn’t something easy.\n\nI haven’t thought that it’s that complicated!";

mail(utf8_decode($to), utf8_decode($subject), utf8_decode($msg), utf8_decode($from)."\nContent-    Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n");?>

Do the encoding/decoding properly. Referred from php mail special characters utf8

Community
  • 1
  • 1
Abhishek Saha
  • 2,564
  • 1
  • 19
  • 29