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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:01:03+00:00 2026-05-12T12:01:03+00:00

After a user adds 5 emails and their name to form below, and then

  • 0

After a user adds 5 emails and their name to form below, and then hits the “send” button, I would like to send a message such as “Hello, your friend ‘sendername’ recommends that you use thissite.com. Please visit the site.” I would also like to specify the from address that this email has on it.

What PHP script could do this?

Thanks in advance,

JOhn

<div class="email1">
<form method="post" action="friends.php">
email address of friend 1:<br>
<input name="email1" type="text" size="55"><br>
<br>
email address of friend 2:<br>
<input name="email2" type="text" size="55"><br>
<br>
email address of friend 3:<br>
<input name="email3" type="text" size="55"><br>
<br>
email address of friend 4:<br>
<input name="email4" type="text" size="55"><br>
<br>
email address of friend 5:<br>
<input name="email5" type="text" size="55"><br>
<br>
your name:<br>
<input name="sendername" type="text" size="55"><br>
<br>
<input type="submit" value="send" name="Send" id="Send"/>
</form> 
  • 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-12T12:01:03+00:00Added an answer on May 12, 2026 at 12:01 pm

    You can use the mail function of php.

    The code would be something like this

    $msg = "a message";
    $subject = "a subject";
    mail($_POST['email1'], $subject,$msg,'From: ' . $_POST['sendername'] . "\n\r" );
    mail($_POST['email2'], $subject,$msg,'From: ' . $_POST['sendername'] . "\n\r" );
    mail($_POST['email3'], $subject,$msg,'From: ' . $_POST['sendername'] . "\n\r" );
    mail($_POST['email4'], $subject,$msg,'From: ' . $_POST['sendername'] . "\n\r" );
    mail($_POST['email5'], $subject,$msg,'From: ' . $_POST['sendername'] . "\n\r" );
    

    Also changing your form to that would make the code more easy

    <div class="email1">
    <form method="post" action="friends.php">
    email address of friend 1:<br>
    <input name="email[]" type="text" size="55"><br>
    <br>
    email address of friend 2:<br>
    <input name="email[]" type="text" size="55"><br>
    <br>
    email address of friend 3:<br>
    <input name="email[]" type="text" size="55"><br>
    <br>
    email address of friend 4:<br>
    <input name="email[]" type="text" size="55"><br>
    <br>
    email address of friend 5:<br>
    <input name="email[]" type="text" size="55"><br>
    <br>
    your name:<br>
    <input name="sendername" type="text" size="55"><br>
    <br>
    <input type="submit" value="send" name="Send" id="Send"/>
    </form>
    

    It would recude the code to

    Hope this helps.

    $msg = "a message";
    $subject = "a subject";
    foreach($_POST['email'] as $email){        
    mail($email, $subject,$msg,'From: ' . $_POST['sendername'] . "\n\r" );
    }
    

    your comment code

    $msg = "<html><body><h1><a href="thissite.com">thissite</a></h1><img src='http://youserver.com/img.jpg'></body></html>";
    $subject = "a subject";
    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    $headers .= 'From: ' . $_POST['sendername'] . "\r\n";
    foreach($_POST['email'] as $email){
    mail($email, $subject,$msg,$headers);
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need help with the Check button. After a user adds all the 42
I want my recaptcha to appear only after user clicks submit button on the
I have pay now form on my page and after user finishes his payment
I'm using WebBrowser Control for my chat application. Every time it adds user's message
In my app i got view, where user adds new object, then he clicks
Goal : After user saves data to my mysql DB, a JSON teaser of
I want to INSERT VALUES after user has clicked OK on the confirmation box.
I am customizing the confirmation email sent after user registration. My problem is that
I need an event/events that will do the following: After user selects text/DOM element,
How can I edit this to run only once after user scroll up: (function

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.