Results 1 to 7 of 7

Thread: Need Help creating a PHP mail form

  1. #1
    Join Date
    Jun 2008
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need Help creating a PHP mail form

    Can someone point me to a tutorial in creating a php web form that will allow me to send an email with the following features.

    1. Send email to multiple addresses
    2. Send the user a confirmation email with the info entered

    Example form:
    (Text boxes)
    Last name:____________
    Address 1:____________
    Address 2:____________
    City:_________________
    Stat:________________
    Zip:_________________
    Day Time Phone:_______________
    Email:________________________

    (Check Box)
    _Agree to Terms

    (Radio Button)
    * Option 1
    * Option 2

    If option 1: Send emails to a@example.com , b@example.com, c@example.com

    If option 2: Send emails to d@example.com , e@example.com, f@example.com

  2. #2
    Join Date
    Jul 2010
    Location
    Minnesota
    Posts
    256
    Thanks
    1
    Thanked 21 Times in 21 Posts

    Default

    This is a tutorial that I used for a newsletter that sends to multiple emails. The idea of what you want is similar so you'll have to modify what is show sot your needs but the concept seems the same to me.
    http://www.youtube.com/user/phpacade...53/cm_VNqF6i7o

    It is a 3 part tutorial I believe.

  3. #3
    Join Date
    Jul 2010
    Location
    NangYang
    Posts
    20
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    use mail function as normal.

  4. #4
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Something like

    PHP Code:
    <form method="post" action="<?php echo $_SERVER['php_self']; ?>">
    <input type="text" name="email" />
    <input type="submit" name="Submit" />
    </form>

    <?php
    if (isset($_POST['Submit']) {
    $email $_POST['email'];
    $subject "Subject";
    $body "Body of email";
    if (
    mail($email$subject$body)) {
    //emailed
    } else {
    echo 
    "Email failed";
    }
    }
    ?>
    Post code for a more detailed answer or see http://php.net/manual/en/function.mail.php

    Jangokoo, you should provide a coding sample or a link rather than just giving a user the name of a function.
    Corrections to my coding/thoughts welcome.

  5. #5
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by Bengal313 View Post
    1. Send email to multiple addresses
    2. Send the user a confirmation email with the info entered
    sending to multiple users: just put the email addresses in a comma-separated list.

    sending confirmation email: Look at bluewalrus' example. Where he has the //emailed comment, you can put code to send a second email - same way you sent the first - to the user, that has your confirmation note.

  6. #6
    Join Date
    Jul 2010
    Location
    NangYang
    Posts
    20
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    @bluewalrus : ok, I will take note this .
    In addition, I was successful to send email by localhost(I mean by mercury mail server).
    But when I try a free host(byehost), I dont know how to configure the mail server to send mail? Any ideas for this?(I tried to search it but no result) Can anyone using byehost help me.
    Thanks alot

  7. #7
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    I don't know about byehost in particular, but free hosts usually don't support sending emails. ask them to be sure.

  8. The Following User Says Thank You to traq For This Useful Post:

    jangkoo (07-23-2010)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •