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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:48:53+00:00 2026-05-30T03:48:53+00:00

This is a relatively simple question that may just not have a solution. Is

  • 0

This is a relatively simple question that may just not have a solution.

Is it possible to set the message To: header and send the email in PHP? Note that message To: is different from the envelope To: header. The latter actually determines where the email is routed, and the former just determines what it shown in the recipient’s email program.

Background: I’m setting up a little disposable email service for myself, so I’m receiving emails with a PHP script, modifying a few headers, and re-sending it to my real email address. I’d like the original recipient email address (the disposable email address) to still show up on the message when I receive it in my real email box (for client-side filtering rules, etc.).

Is this possible? I’ve been able to modify every other type of header, but this one has me stuck.

  • 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-30T03:48:54+00:00Added an answer on May 30, 2026 at 3:48 am

    Thanks for everyone’s help! I found an excellent solution, so I thought I’d share.

    I ended up just extending CodeIgniter’s email class to set a To header (I’m heretofore going to start calling it a vanity header since it’s all looks and no substance) and sending via SMTP. If you want to see a simple example of what I did, extend the Email class with your own MY_Email.php file (see the section on Extending Native Libraries in the User Guide) and copy over the _build_headers() function from the Email class.

        /**
     * Build final headers
     *
     * @access  protected
     * @param   string
     * @return  string
     */
    protected function _build_headers()
    {
        $this->_set_header('X-Sender', $this->clean_email($this->_headers['From']));
        $this->_set_header('X-Mailer', $this->useragent);
        $this->_set_header('X-Priority', $this->_priorities[$this->priority - 1]);
        $this->_set_header('Message-ID', $this->_get_message_id());
        $this->_set_header('Mime-Version', '1.0');
    }
    

    Then add your own header on the line immediately below the Mime-Version line, like so:

        $this->_set_header('To', 'person@example.com');
    

    Then just send a regular email to one of your own email addresses. You’ll notice that even though the email arrives at your address, it appears to be addressed to person@example.com.

    Boom.

    If you’d like to actually use the full MY_Email.php file I created to add a “Vanity To” option to your own CodeIgniter project, see this gist.

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

Sidebar

Related Questions

I think that this is a relatively simple question. I just want to know
I am a relatively new programmer so this may be a really simple question
I have a relatively simple question that I cant figure out and I cant
I'm sure this is a relatively simple question, it's just one thing I've always
I have what should be a relatively simple question that I can't seem to
I'm sure this is a relatively simple question, and there must be a good
Hopefully this is simple: I have a relatively long list where each list item
I just cannot figure this out, it looks really simple but I'm relatively new
I think this is a relatively simple question, but I don't precisely know what's
A relatively simple question. I have a datagridview, which all it does is displays

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.