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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:52:28+00:00 2026-05-21T16:52:28+00:00

<?php if ($_POST[‘friends-email’]) { $name = Sender’s Name; $email = sender@domain.com; $recipient = preg_replace(/[^a-z0-9

  • 0
<?php
  if ($_POST['friends-email']) {
      $name = "Sender's Name";
      $email = "sender@domain.com";
      $recipient = preg_replace("/[^a-z0-9 !?:;,.\/_\-=+@#$&amp;\*\(\)]/im", "", $_POST['friends-email']);
      $recipient = preg_replace("/(content-type:|bcc:|cc:|to:|from:)/im", "", $recipient);
      $mail_body = "Default Description";
      $subject = "Default Subject";
      $header = "From: " . $name . " <" . $email . ">\r\n";
      mail($recipient, $subject, $mail_body, $header);

      echo 'Thank you for recommending <br /> us!';

  }  else {
      echo '<form action="" method="post" name="send2friend" id="send2friend">
                Friends Email*:
                <input name="friends-email" id="friends-email" type="text" />
                <input type="submit" value="continue" />
            </form>';
  }
?>

Not sure why this isn’t working, I get the “thank you message” but the email is not delivered when I test using my own emails.

  • 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-21T16:52:29+00:00Added an answer on May 21, 2026 at 4:52 pm

    Just stating the obvious, but where you have put $email = "sender@domain.com";, you are actually changing that to a variable right?

    Do you have all PHP errors turned on and displaying?

    error_reporting(E_ALL);
    ini_set('display_errors', '1');
    

    Use PHP interactive mode (php -a)to deploy an email

    $to      = 'dummymailing@mailinator.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: webmaster@example.com' . "\r\n"; mail($to, $subject, $message, $headers);
    

    Then go here to check that it’s received. This is just to check that it’s not a problem with your email client – i.e. it’s not blocking the email.

    If you’re still having problems, it could be something to do with the system’s sendmail function. This post on serverfault provides a lot of detailed advice on debugging the sendmail function.

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

Sidebar

Related Questions

I have an HTML form: <form action='process.php' method='post'> <input type='checkbox' name='check_box_1' /> Check me!<br>
I have this HTML: <form action='uploadhandle.php' method='POST' enctype=multipart/form-data> <input type='file' class='fileinput' id='photo1' name='photo1'> <input
I am using the php post request example given on http://code.google.com/apis/chart/docs/post_requests.html for generating chart.
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
Possible Duplicate: php $_POST array empty upon form submission I just make a simple
I have tried to different ways to clear a form: <form action=service.php id=addRunner name=addRunner
I want to use this function: http://www.frankmacdonald.co.uk/php/post-to-wordpress-with-php.html Its used to post to Wordpress using
I have a PHP script on a server <?php // retrieve POST vars $comment
I'm using CakeDC-Users plugin. <?php class Post extends AppModel { public $useTable='posts'; public $belongsTo
For example (in my case) here's some code, <?php woo_post_inside_before(); if ( $woo_options['woo_post_content'] !=

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.