php and html email formsHow do you disable browser Autocomplete on web form field / input tag?How can I prevent SQL injection in PHP?What are valid values for the id attribute in HTML?Deleting an element from an array in PHPConvert HTML + CSS to PDF with PHP?HTML 5: Is it <br>, <br/>, or <br />?How do you parse and process HTML/XML in PHP?Reference — What does this symbol mean in PHP?Why does HTML think “chucknorris” is a color?Why shouldn't I use mysql_* functions in PHP?

German idiomatic equivalents of 能骗就骗 (if you can cheat, then cheat)

Why are examinees often not allowed to leave during the start and end of an exam?

What does this Pokemon Trainer mean by saying the player is "SHELLOS"?

How to extract coefficients of a generating function like this one, using a computer?

What is the meaning of "it" in "as luck would have it"?

How soon after takeoff can you recline your airplane seat?

Which are more efficient in putting out wildfires: planes or helicopters?

Why can't i use !(single pattern) in zsh even after i turn on kshglob?

Why am I getting an electric shock from the water in my hot tub?

Variable declaration inside main loop

Existence of infinite set of positive integers s.t sum of reciprocals is rational and set of primes dividing an element is infinite

What could a Medieval society do with excess animal blood?

I agreed to cancel a long-planned vacation (with travel costs) due to project deadlines, but now the timeline has all changed again

What verb goes with "coup"?

Lenovo Legion PXI-E61 Media Test Failure, Check Cable. Exiting PXE ROM. Then restarts and works fine

Why will we fail creating a self sustaining off world colony?

Emphasize numbers in tables

Why would Dementors torture a Death Eater if they are loyal to Voldemort?

Classify 2-dim p-adic galois representations

When does it become illegal to exchange bitcoin for cash?

Does friction always oppose motion?

What type of education should I select in this form?

Merging two data frames into a new one with unique items marked with 1 or 0

How do I tell my girlfriend she's been buying me books by the wrong author for the last nine months?



php and html email forms


How do you disable browser Autocomplete on web form field / input tag?How can I prevent SQL injection in PHP?What are valid values for the id attribute in HTML?Deleting an element from an array in PHPConvert HTML + CSS to PDF with PHP?HTML 5: Is it <br>, <br/>, or <br />?How do you parse and process HTML/XML in PHP?Reference — What does this symbol mean in PHP?Why does HTML think “chucknorris” is a color?Why shouldn't I use mysql_* functions in PHP?













0















I am creating a website for my church choir in HTML. I have a "contact us" page written in HTML. It has a form for the user to send the choir director an email from the website. I am aware that I have to write the email in php in order for the email to send. Do I need to duplicate the html file and rewrite it in PHP?



<form name="Send-mail" action="mailto:email@email.com" method="post">
<label>Name:</label>
<input class="nice" name="name" type="text"/>
<label>Email:</label>
<input class="nice" name="email" type="text"/>
<label>Subject:</label>
<input class="nice" name="subject" type="text"/>`enter code here`
<label>Message:</label>
<text-area type="text" name="message"></text-area>
<input class="centered" type="submit" name="submit" value="Send email"/>
</form>


I need the server to send the email from the website to the email of our choir director.










share|improve this question


























    0















    I am creating a website for my church choir in HTML. I have a "contact us" page written in HTML. It has a form for the user to send the choir director an email from the website. I am aware that I have to write the email in php in order for the email to send. Do I need to duplicate the html file and rewrite it in PHP?



    <form name="Send-mail" action="mailto:email@email.com" method="post">
    <label>Name:</label>
    <input class="nice" name="name" type="text"/>
    <label>Email:</label>
    <input class="nice" name="email" type="text"/>
    <label>Subject:</label>
    <input class="nice" name="subject" type="text"/>`enter code here`
    <label>Message:</label>
    <text-area type="text" name="message"></text-area>
    <input class="centered" type="submit" name="submit" value="Send email"/>
    </form>


    I need the server to send the email from the website to the email of our choir director.










    share|improve this question
























      0












      0








      0








      I am creating a website for my church choir in HTML. I have a "contact us" page written in HTML. It has a form for the user to send the choir director an email from the website. I am aware that I have to write the email in php in order for the email to send. Do I need to duplicate the html file and rewrite it in PHP?



      <form name="Send-mail" action="mailto:email@email.com" method="post">
      <label>Name:</label>
      <input class="nice" name="name" type="text"/>
      <label>Email:</label>
      <input class="nice" name="email" type="text"/>
      <label>Subject:</label>
      <input class="nice" name="subject" type="text"/>`enter code here`
      <label>Message:</label>
      <text-area type="text" name="message"></text-area>
      <input class="centered" type="submit" name="submit" value="Send email"/>
      </form>


      I need the server to send the email from the website to the email of our choir director.










      share|improve this question














      I am creating a website for my church choir in HTML. I have a "contact us" page written in HTML. It has a form for the user to send the choir director an email from the website. I am aware that I have to write the email in php in order for the email to send. Do I need to duplicate the html file and rewrite it in PHP?



      <form name="Send-mail" action="mailto:email@email.com" method="post">
      <label>Name:</label>
      <input class="nice" name="name" type="text"/>
      <label>Email:</label>
      <input class="nice" name="email" type="text"/>
      <label>Subject:</label>
      <input class="nice" name="subject" type="text"/>`enter code here`
      <label>Message:</label>
      <text-area type="text" name="message"></text-area>
      <input class="centered" type="submit" name="submit" value="Send email"/>
      </form>


      I need the server to send the email from the website to the email of our choir director.







      php html css






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 25 at 17:23









      IvanMoodyIvanMoody

      112 bronze badges




      112 bronze badges




















          2 Answers
          2






          active

          oldest

          votes


















          2














          You would need to create the PHP file where there is an email sending logic,eg: sendEmail.php. The form tag would change to:



          <form name="Send-mail" action="sendEmail.php" method="post">





          share|improve this answer

























          • Would I name the file the same as the html file e.g. index.html --> index.php

            – IvanMoody
            Mar 25 at 17:28











          • You are free to set any name you like. But if you have an index.html, then avoid index.php

            – Anurag Srivastava
            Mar 25 at 17:29


















          1














          Below is how you can send the mail in php from form inputs.



           <form action="mail.php" method="post">
          <label>Name:</label>
          <input class="nice" name="name" type="text"/>
          <label>Email:</label>
          <input class="nice" name="email" type="text"/>
          <label>Subject:</label>
          <input class="nice" name="subject" type="text"/>`enter code here`
          <label>Message:</label>
          <text-area type="text" name="message"></text-area>
          <input class="centered" type="submit" name="submit" value="Send email"/>
          </form>


          You will have to name your php file mail.php like in case below



          mail.php



          <?php
          $to = $_POST['email'];
          $subject = $_POST['subject'];
          $sender = $_POST['name'];

          $message = $_POST['message'];
          $message .= "<h1>This is Message from $sender.</h1>";

          $header = "From:senderemail@somedomain.com rn";
          $header .= "Cc:senderemail@somedomain.com rn";
          $header .= "MIME-Version: 1.0rn";
          $header .= "Content-type: text/htmlrn";

          $retval = mail ($to,$subject,$message,$header);

          if( $retval == true )
          echo "Message sent successfully...";
          else
          echo "Message could not be sent...";

          ?>


          You will need to ensure that email for this line of code is correctly set.



          $header = "From:senderemail@somedomain.com rn";
          $header .= "Cc:senderemail@somedomain.com rn";


          In otherword, if your site email is support@hey.com
          Try Replacing it snderemail@somedomain and it will work. You can also try the replacement with some other emails like good working gmail and let me know what happen. Thanks






          share|improve this answer

























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55343348%2fphp-and-html-email-forms%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            You would need to create the PHP file where there is an email sending logic,eg: sendEmail.php. The form tag would change to:



            <form name="Send-mail" action="sendEmail.php" method="post">





            share|improve this answer

























            • Would I name the file the same as the html file e.g. index.html --> index.php

              – IvanMoody
              Mar 25 at 17:28











            • You are free to set any name you like. But if you have an index.html, then avoid index.php

              – Anurag Srivastava
              Mar 25 at 17:29















            2














            You would need to create the PHP file where there is an email sending logic,eg: sendEmail.php. The form tag would change to:



            <form name="Send-mail" action="sendEmail.php" method="post">





            share|improve this answer

























            • Would I name the file the same as the html file e.g. index.html --> index.php

              – IvanMoody
              Mar 25 at 17:28











            • You are free to set any name you like. But if you have an index.html, then avoid index.php

              – Anurag Srivastava
              Mar 25 at 17:29













            2












            2








            2







            You would need to create the PHP file where there is an email sending logic,eg: sendEmail.php. The form tag would change to:



            <form name="Send-mail" action="sendEmail.php" method="post">





            share|improve this answer















            You would need to create the PHP file where there is an email sending logic,eg: sendEmail.php. The form tag would change to:



            <form name="Send-mail" action="sendEmail.php" method="post">






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 25 at 17:29

























            answered Mar 25 at 17:27









            Anurag SrivastavaAnurag Srivastava

            3,4723 gold badges14 silver badges22 bronze badges




            3,4723 gold badges14 silver badges22 bronze badges












            • Would I name the file the same as the html file e.g. index.html --> index.php

              – IvanMoody
              Mar 25 at 17:28











            • You are free to set any name you like. But if you have an index.html, then avoid index.php

              – Anurag Srivastava
              Mar 25 at 17:29

















            • Would I name the file the same as the html file e.g. index.html --> index.php

              – IvanMoody
              Mar 25 at 17:28











            • You are free to set any name you like. But if you have an index.html, then avoid index.php

              – Anurag Srivastava
              Mar 25 at 17:29
















            Would I name the file the same as the html file e.g. index.html --> index.php

            – IvanMoody
            Mar 25 at 17:28





            Would I name the file the same as the html file e.g. index.html --> index.php

            – IvanMoody
            Mar 25 at 17:28













            You are free to set any name you like. But if you have an index.html, then avoid index.php

            – Anurag Srivastava
            Mar 25 at 17:29





            You are free to set any name you like. But if you have an index.html, then avoid index.php

            – Anurag Srivastava
            Mar 25 at 17:29











            1














            Below is how you can send the mail in php from form inputs.



             <form action="mail.php" method="post">
            <label>Name:</label>
            <input class="nice" name="name" type="text"/>
            <label>Email:</label>
            <input class="nice" name="email" type="text"/>
            <label>Subject:</label>
            <input class="nice" name="subject" type="text"/>`enter code here`
            <label>Message:</label>
            <text-area type="text" name="message"></text-area>
            <input class="centered" type="submit" name="submit" value="Send email"/>
            </form>


            You will have to name your php file mail.php like in case below



            mail.php



            <?php
            $to = $_POST['email'];
            $subject = $_POST['subject'];
            $sender = $_POST['name'];

            $message = $_POST['message'];
            $message .= "<h1>This is Message from $sender.</h1>";

            $header = "From:senderemail@somedomain.com rn";
            $header .= "Cc:senderemail@somedomain.com rn";
            $header .= "MIME-Version: 1.0rn";
            $header .= "Content-type: text/htmlrn";

            $retval = mail ($to,$subject,$message,$header);

            if( $retval == true )
            echo "Message sent successfully...";
            else
            echo "Message could not be sent...";

            ?>


            You will need to ensure that email for this line of code is correctly set.



            $header = "From:senderemail@somedomain.com rn";
            $header .= "Cc:senderemail@somedomain.com rn";


            In otherword, if your site email is support@hey.com
            Try Replacing it snderemail@somedomain and it will work. You can also try the replacement with some other emails like good working gmail and let me know what happen. Thanks






            share|improve this answer



























              1














              Below is how you can send the mail in php from form inputs.



               <form action="mail.php" method="post">
              <label>Name:</label>
              <input class="nice" name="name" type="text"/>
              <label>Email:</label>
              <input class="nice" name="email" type="text"/>
              <label>Subject:</label>
              <input class="nice" name="subject" type="text"/>`enter code here`
              <label>Message:</label>
              <text-area type="text" name="message"></text-area>
              <input class="centered" type="submit" name="submit" value="Send email"/>
              </form>


              You will have to name your php file mail.php like in case below



              mail.php



              <?php
              $to = $_POST['email'];
              $subject = $_POST['subject'];
              $sender = $_POST['name'];

              $message = $_POST['message'];
              $message .= "<h1>This is Message from $sender.</h1>";

              $header = "From:senderemail@somedomain.com rn";
              $header .= "Cc:senderemail@somedomain.com rn";
              $header .= "MIME-Version: 1.0rn";
              $header .= "Content-type: text/htmlrn";

              $retval = mail ($to,$subject,$message,$header);

              if( $retval == true )
              echo "Message sent successfully...";
              else
              echo "Message could not be sent...";

              ?>


              You will need to ensure that email for this line of code is correctly set.



              $header = "From:senderemail@somedomain.com rn";
              $header .= "Cc:senderemail@somedomain.com rn";


              In otherword, if your site email is support@hey.com
              Try Replacing it snderemail@somedomain and it will work. You can also try the replacement with some other emails like good working gmail and let me know what happen. Thanks






              share|improve this answer

























                1












                1








                1







                Below is how you can send the mail in php from form inputs.



                 <form action="mail.php" method="post">
                <label>Name:</label>
                <input class="nice" name="name" type="text"/>
                <label>Email:</label>
                <input class="nice" name="email" type="text"/>
                <label>Subject:</label>
                <input class="nice" name="subject" type="text"/>`enter code here`
                <label>Message:</label>
                <text-area type="text" name="message"></text-area>
                <input class="centered" type="submit" name="submit" value="Send email"/>
                </form>


                You will have to name your php file mail.php like in case below



                mail.php



                <?php
                $to = $_POST['email'];
                $subject = $_POST['subject'];
                $sender = $_POST['name'];

                $message = $_POST['message'];
                $message .= "<h1>This is Message from $sender.</h1>";

                $header = "From:senderemail@somedomain.com rn";
                $header .= "Cc:senderemail@somedomain.com rn";
                $header .= "MIME-Version: 1.0rn";
                $header .= "Content-type: text/htmlrn";

                $retval = mail ($to,$subject,$message,$header);

                if( $retval == true )
                echo "Message sent successfully...";
                else
                echo "Message could not be sent...";

                ?>


                You will need to ensure that email for this line of code is correctly set.



                $header = "From:senderemail@somedomain.com rn";
                $header .= "Cc:senderemail@somedomain.com rn";


                In otherword, if your site email is support@hey.com
                Try Replacing it snderemail@somedomain and it will work. You can also try the replacement with some other emails like good working gmail and let me know what happen. Thanks






                share|improve this answer













                Below is how you can send the mail in php from form inputs.



                 <form action="mail.php" method="post">
                <label>Name:</label>
                <input class="nice" name="name" type="text"/>
                <label>Email:</label>
                <input class="nice" name="email" type="text"/>
                <label>Subject:</label>
                <input class="nice" name="subject" type="text"/>`enter code here`
                <label>Message:</label>
                <text-area type="text" name="message"></text-area>
                <input class="centered" type="submit" name="submit" value="Send email"/>
                </form>


                You will have to name your php file mail.php like in case below



                mail.php



                <?php
                $to = $_POST['email'];
                $subject = $_POST['subject'];
                $sender = $_POST['name'];

                $message = $_POST['message'];
                $message .= "<h1>This is Message from $sender.</h1>";

                $header = "From:senderemail@somedomain.com rn";
                $header .= "Cc:senderemail@somedomain.com rn";
                $header .= "MIME-Version: 1.0rn";
                $header .= "Content-type: text/htmlrn";

                $retval = mail ($to,$subject,$message,$header);

                if( $retval == true )
                echo "Message sent successfully...";
                else
                echo "Message could not be sent...";

                ?>


                You will need to ensure that email for this line of code is correctly set.



                $header = "From:senderemail@somedomain.com rn";
                $header .= "Cc:senderemail@somedomain.com rn";


                In otherword, if your site email is support@hey.com
                Try Replacing it snderemail@somedomain and it will work. You can also try the replacement with some other emails like good working gmail and let me know what happen. Thanks







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 25 at 17:47









                Nancy MooreeNancy Mooree

                9021 gold badge3 silver badges10 bronze badges




                9021 gold badge3 silver badges10 bronze badges



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55343348%2fphp-and-html-email-forms%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript