PHP: Spoofing E-Mail From, Reply-To, etc Headers

Posted on 2006-05-29
Last Modified: 2008-01-09
I have a problem:  in php, I use the mail() function to send e-mails.  The mail() function allows me to set From and Reply-To headers.  That works fine.  However, when I send an e-mail to a cell phone (ex, sending an email to, the From and Reply-To headers aren't spoofed.  For some reason, with cell phones, spoofing the headers doens't work.  Any ideas?
Question by:jtk07
    LVL 10

    Expert Comment

    Depends on what you mean by 'spoofing the headers'.  If you mean it doesn't use the from and to that you set, what is showing up as the from and to on the other end?
    LVL 4

    Accepted Solution


    The best way to control headers is to use the open source GPL phpmailer() class and build your email using it.  It takes the place of the mail() function and gives you excellent control.  It is not really very hard to impliment, just include the class in your page and make a few changes to the way you construct your email.

    Download the class at

    The package contains excellent documentation and examples that will help you to build exactly the headers that you want for any application.

    LVL 44

    Expert Comment

    following rbartz, the PHP mail () function was not designed for cell phone addresses (at least not working for it), and you will have to use a different MAIL() function until they update the code, or else design your own, as he says.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
    Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit ( and similar technologies have enjoyed wide adoption, making it possib…
    Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
    This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now