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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:21:40+00:00 2026-06-09T20:21:40+00:00

I want to send an e-mail using the mail-function in PHP. The FROM-part of

  • 0

I want to send an e-mail using the mail-function in PHP. The “FROM”-part of the header should contain a name with a space

 name with space <mail@server.tld>

Unfortunately, some mail clients cannot handle the spaces. Thats why e.g. Thunderbird adds quotes to the name.

 "name with space" <mail@server.tld>

That works fine, until you add special characters like ÄÖÜ, since they need to be encoded. The follwing would not work:

 "name with ÄÖÜ and space" <mail@server.tld>

Thats why I tried the function mb_encode_mimeheader

echo mb_encode_mimeheader("name with"." ÄÖÜ"." and space", "ISO-8859-1", "Q");
# result:
# name with =?ISO-8859-1?Q?=C3=84=C3=96=C3=9C=20and=20space?=

That still does not work, since before the first occurence of the special characters, the spaces are still in the string. the correct result schould be:

=?ISO-8859-1?Q?name=20with=20=C3=84=C3=96=C3=9C=20and=20space?=

Is there a function in PHP that can handle this? or should I use a mixture of quotes and ´mb_encode_mimeheader´? Or is there a different way to handle spaces in mailheaders? To be honest, I did not understand the meaning of the different whitespaces mentioned in the RFC822.

  • 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-06-09T20:21:42+00:00Added an answer on June 9, 2026 at 8:21 pm

    You don’t need quotes. RFC2047-encoding (i.e. mb_encode) handles spaces as well.

    (Although for the record, just plain spaces are completely unproblematic; they are not the reason some clients use quoting, which is often completely redundant anyway. So the result with the spaces is actually not incorrect at all.)

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

Sidebar

Related Questions

I am using java to send mail. I want to set the from mail
I want to send a mail from localhost. I am using XAMPP to develop
I am using mail function as i want to send message in a format
I'm using PHP's mail() function to send SMS messages. It works fine, except that
I am trying to create a PHP function to send an e-mail using SMTP
I want to send email using the php code, Following is the code should
I want to generate an email using the mail() function: <?php $to = 'nobody@example.com';
I am using log4net. When Application gives an error, I want to send e-mail
All, I want to send a mail from Unix OS (without GUI) to MS
Hai guys, I want to send scheduled mail every morning from my application and

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.