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

  • Home
  • SEARCH
  • 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 8397385
In Process

The Archive Base Latest Questions

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

I have this code, that is supposed to send a mail to an address.

  • 0

I have this code, that is supposed to send a mail to an address. The problems is: in the header i’m supposed to get the name like “Bob Marley” for instance, but it says “(unknown sender)” if the name is greater then one word. If the name is exactly one word, it works. If i concatenate the $_POST[‘nume’] value to the $message, it’s all there. For some reason, in the header, it does not work like it should.

<form name="contact" method="post" class="clearfix" id="formular">
   <input class="inputC" type="text" placeholder="Full Name" id="numeCo" onClick="clearValue(this.id)" onBlur="testValue(this.id)" name="nume"/>

   <input class="inputC" type="text" placeholder="E-mail Address" id="adresaCo" onClick="clearValue(this.id)" onBlur="testValue(this.id)" name="adrMail"/>

   <input class="inputC" type="text" placeholder="What services do you need?" id="serviciiCo" onClick="clearValue(this.id)" onBlur="testValue(this.id)" name="servicii"/>

   <div class="sumarise">
   <textarea class="textAreaC" placeholder="Please summarize your project..." id="textArCo" onClick="clearValue(this.id)" onBlur="testValue(this.id)" name="descriere"></textarea>
   </div>
   <div class="sB clearfix">
   <input class="submitC" type="submit" value="Send Message" />
   </div>                              
   </form>
   <?php
   if(isset($_POST['nume'], $_POST['adrMail'], $_POST['descriere']))
    {
     /*echo "<script> return checkForm();</script>";*/
     $to = "radu.mircea.andrei@gmail.com";                                                                              
     $subject = $_POST['servicii'];
     $message = $_POST['descriere'];                                        
     $name = $_POST['nume'];
     $headers= "From: ".$name."\n".'Reply-To: '.$_POST['adrMail'];
     mail($to,$subject,$message,$headers);                                      
    }
  ?>
  • 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:46:33+00:00Added an answer on June 9, 2026 at 8:46 pm

    I am going to put this as answer because I think it is quite important for you to note.

    There is a vulnerability when using the mail() function as you are with user defined From headers. See this question here: Proper prevention of mail injection in PHP

    However to solve your actual problem:

    • Try using \r\n as well (like @Sudhir said) (I find \r\n is more compliant with some mail clients)
    • Put in a email too like @Sohnee says
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ActionMailer controller that's supposed to send this file: /user_mailer/welcome_email.text.erb This is
So I have the following code. It's supposed to send HTML emails that were
I have this piece of code that is supposed to work on Firefox 3.6
I have this code that suppose to place the marker by the latlng public
I have this javascript code below that uses jquery, it is suppoed to be
I have this code that I've edited: http://pastebin.com/vrqHek6S I've put in comments where I
I have this code that runs but never stops. class A { public static
I have this code that reads from XML file. It gets five strings (groupId,
I have this code that where I would normally use one line: if (tableView
I have this code that works in a unit test but doesn't work when

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.