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 877241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:34:26+00:00 2026-05-15T11:34:26+00:00

Do we need to use quotes in $to and in from/cc/bcc mail headers when

  • 0

Do we need to use quotes in $to and in from/cc/bcc mail headers when using PHP mail function?

I mean, let’s say I want to send mail to:

User One <user@domain.com>

Do I have to call:

mail("\"User One\" <user@domain.com>", ...

OR

mail("User One <user@domain.com>", ...

I suppoose once you give me an answer for the $to, it is going to be the same for other mail headers, that I normally add in this way:

$mail_headers  = "From: " . $from . "\r\n";      
$mail_headers .= "Cc: " . $cc . "\r\n";
$mail_headers .= "Bcc: " . $bcc . "\r\n";
$mail_headers .= "MIME-Version: 1.0\r\nContent-type: text/plain;\r\n\tcharset=\"Windows-1252\";\r\nContent-Transfer-Encoding: 8bit" . "\r\n";      
//I use "Windows-1252" charset, cause "iso-8859-1" DOES NOT DISPLAY EURO CHAR!

mail($to, $subject, $body, $mail_headers);

Maybe I need to use quotes in case there is a single quote in header? I don’t know sometimes I saw examples with quotes, other time without them, does anyone know, and maybe explain.

Thanks!

  • 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-15T11:34:27+00:00Added an answer on May 15, 2026 at 11:34 am

    If I read the relevant RFC right:

    Strings of characters that include characters other than those
    allowed in atoms may be represented in a quoted string format, where
    the characters are surrounded by quote (DQUOTE, ASCII value 34)
    characters.

    A quoted-string is treated as a unit. That is, quoted-string is
    identical to atom, semantically.

    the correct character to wrap a string in is the double quote " (and only that), but it is optional.

    I would highly recommend using it, though, if your recipient name contains spaces.

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

Sidebar

Related Questions

I want to send an e-mail using the mail-function in PHP. The FROM-part of
I have installed Matlab r2010a on my computer I need use the function xlsread
i have to get stock quotes from yahoo finance api n use it in
I'm using the jackson library for serializing/deserializing to/from JSON. I need that this JSON
Using PHP to extract data from SQL and then creating a .csv file on
I'm using PDO after migrating away from the mysql library. What do I use
I need use this method with three distinct classes: Orders, Customers, Suppliers public void
I need use this code: <%= button_tag :class => btn btn-primary do %> <%=
So, I need use this event so I can navigate trought blog posts. I
Need to use own imaged markers instead built-in pins. I have several questions. 1.

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.