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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:58:16+00:00 2026-05-20T10:58:16+00:00

For some reason, when php mail() is sent to a text number (via email)

  • 0

For some reason, when php mail() is sent to a text number (via email) i.e. 123456789@vtext.com; the from shows up as the centos apache server output email (apache@host-name.com). However, I’ve included the correct headers; so when the same mail() is pushed to (for example) gmail it comes and shows normal with all the correct headers / mime type / from.

Any idea?

Here’s the code for the normal mail

$headers = "From: Alert@thedomain.com \r\n";
$headers .= "Date: ". date('r') . "\r\n"; 
$headers .= "Content-Type: text/html; charset=utf-8"; 
$headers .= "MIME-Version: 1.0 ";   
$body = "body message";
mail($userinfo->username,"thedomain",$body,$headers);

And the code for the mobile: (We don’t use date/content type/ mime for text msgs, or else the headers shows up in the txt msg)

$headers = "From: Alert@thedomain.com \r\n";    
$body = "body message";
mail($userinfo->mobile,"thedomain",$body,$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-05-20T10:58:17+00:00Added an answer on May 20, 2026 at 10:58 am

    Try sending with the additional -f flag to the mail function:

    mail($userinfo->username,"thedomain",$body,$headers, "-ffromaddress@example.com");
    

    See the manual for more information on additional parameters

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

Sidebar

Related Questions

I have various emails being sent out via PHP mail. The problem is, for
Hi guys for some weird reason I'm unable to send email using zend mail
For some reason, I want to serve my robots.txt via a PHP script. I
For some reason one installation of Moodle 1.9.3+ has a problem that file.php returns
Okay so im working on this php image upload system but for some reason
I will have to send mails from a php website via smtp. The smtp
For some reason I can't get Basic Authentication to work using PHP on my
for some reason i get error 500 in this file: http://apps.sce.ac.il/testxml/parser.php this is the
What are some reasons why PHP would force errors to show, no matter what
For some reason I never see this done. Is there a reason why not?

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.