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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:29:32+00:00 2026-05-22T19:29:32+00:00

How can i use the mail by header in php? This is what i

  • 0

How can i use the mail by header in php?

This is what i use now:

//define the headers we want passed. Note that they are separated with \r\n

$headers = "From: test@gmail.com\r\nReply-To:test@gmail.com";

//send the email
$to = "test@gmail.com";

 $subject = "This is a subject";

 $body = "Hi there!";

 if (mail($to, $subject, $body,$headers)) 
{

echo("\nMessages successfully sent!");

  } else {

   echo("\nMessages delivery failed...");
  }

I get this on my gmail when i click on show details:

from test@gmail.com
reply-to testreply@gmail.com
to test@gmail.com
date Sat, May 14, 2011 at 12:06 AM
subject stefanos neofitidis! You commented on your poem:Tree present
mailed-by ip-1-1-1-1.ip.secureserver.net

i do not want to the ip-1-1-1-1.ip.secureserver.net to show up to the users…this is what i am trying to change!

  • 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-22T19:29:32+00:00Added an answer on May 22, 2026 at 7:29 pm

    What you want to do is add a fifth parameter in your mail() function, which needs to use the "-f" sendmail option.

    For example:

    mail($to, $subject, $body, $headers, "-fsender@domain.com");
    

    Sending a message with that last parameter will change the envelope sender to "sender@domain.com". Most of the time, email providers like gmail won’t even show that address if it is set by hand(which is what you want, I’m assuming).

    See https://www.php.net/function.mail for more details.

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

Sidebar

Related Questions

is there anyway that I can use mailto with empty recipient? I only want
I can use VS08's MFC/ActiveX template to create a C++ ActiveX object that I
I got a strange problem with php mail and exchange. When I use the
When I send mail from php with rn as line break in the headers
I can't fetch email body content. This is my code <?php /* connect to
I want to ask that sometimes what happen that if I use PrimeFaces Rich
My aspx page is hosted by Discountasp.net. I can use System.Net.Mail.MailMessage to send an
Client asked this morning if we can provide a subscription service whereby: Mail arives
I've got a PHP script that my mail server is piping emails to via
I figure I can either use one mail() command with a large Bcc list

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.