Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: I'm not sure if this is a PHP thing... but for Email

  1. #11
    Join Date
    Sep 2006
    Location
    Fairfield California!
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    oh i see, Ill check!

  2. #12
    Join Date
    Sep 2006
    Location
    Fairfield California!
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ok... no they dont give it to me... is another name for it POP mail? thats all they had and it was a forwarding thing but it cost more money to do that... I perfer the free way!

  3. #13
    Join Date
    Sep 2006
    Location
    Fairfield California!
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I found this

    Can you look over this and see if this is what I need... also tell me if i need to change anything on it I noticed up top where i need my domain name and email adress...



    <?php
    /* PHP Form Mailer - phpFormMailer v2.1, last updated 30th Nov 2005 - check back often for updates!
    (easy to use and more secure than many cgi form mailers) FREE from:
    www.TheDemoSite.co.uk
    Should work fine on most Unix/Linux platforms */

    // ------- three variables you MUST change below -------------------------------------------------------
    $valid_ref1="http://Your--domain/contact.html";// chamge "Your--domain" to your domain
    $valid_ref2="http://www.Your--domain/contact.html";// chamge "Your--domain" to your domain
    $replyemail="YOU@Your--domain";//change to your email address
    // ------------------------------------------------------------

    //clean input in case of header injection attempts!
    function clean_input_4email($value, $check_all_patterns = true)
    {
    $patterns[0] = '/content-type:/';
    $patterns[1] = '/to:/';
    $patterns[2] = '/cc:/';
    $patterns[3] = '/bcc:/';
    if ($check_all_patterns)
    {
    $patterns[4] = '/\r/';
    $patterns[5] = '/\n/';
    $patterns[6] = '/%0a/';
    $patterns[7] = '/%0d/';
    }
    //NOTE: can use str_ireplace as this is case insensitive but only available on PHP version 5.0.
    return preg_replace($patterns, "", strtolower($value));
    }

    $name = clean_input_4email($_POST["name"]);
    $email = clean_input_4email($_POST["email"]);
    $thesubject = clean_input_4email($_POST["thesubject"]);
    $themessage = clean_input_4email($_POST["themessage"], false);

    $error_msg='ERROR - not sent. Try again.';

    $success_sent_msg='<p align="center"><strong>&nbsp;</strong></p>
    <p align="center"><strong>Your message has been successfully sent to us<br>
    </strong> and we will reply as soon as possible.</p>
    <p align="center">A copy of your query has been sent to you.</p>
    <p align="center">Thank you for contacting us.</p>';

    $replymessage = "Hi $name

    Thank you for your email.

    We will endeavour to reply to you shortly.

    Please DO NOT reply to this email.

    Below is a copy of the message you submitted:
    --------------------------------------------------
    Subject: $thesubject
    Query:
    $themessage
    --------------------------------------------------

    Thank you";

    // email variable not set - load $valid_ref1 page
    if (!isset($_POST['email']))
    {
    echo "<script language=\"JavaScript\"><!--\n ";
    echo "top.location.href = \"$valid_ref1\"; \n// --></script>";
    exit;
    }

    $ref_page=$_SERVER["HTTP_REFERER"];
    $valid_referrer=0;
    if($ref_page==$valid_ref1) $valid_referrer=1;
    elseif($ref_page==$valid_ref2) $valid_referrer=1;
    if(!$valid_referrer)
    {
    echo "<script language=\"JavaScript\"><!--\n alert(\"$error_msg\");\n";
    echo "top.location.href = \"$valid_ref1\"; \n// --></script>";
    exit;
    }
    $themessage = "name: $name \nQuery: $themessage";
    mail("$replyemail",
    "$thesubject",
    "$themessage",
    "From: $email\nReply-To: $email");
    mail("$email",
    "Receipt: $thesubject",
    "$replymessage",
    "From: $replyemail\nReply-To: $replyemail");
    echo $success_sent_msg;
    /*
    PHP Form Mailer - phpFormMailer (easy to use and more secure than many cgi form mailers)
    FREE from:

    www.TheDemoSite.co.uk */
    ?>

  4. #14
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    That script isn't too complex, but might be more than you need.
    It depends what you want.
    It has a nice little security validator to be sure the messages don't contain anything that would cause problems, but not sure if that's needed.

    If you want to code it yourself, learn php. There's no shortcut.

    $_POST['test'] would hold the value of <input type="*any*" name="test"> once sent to the next page.

    For example...

    on next page.php, you could have:
    <?php mail($_PoST['test']); ?>
    and it would mail the contents of the "test" field from the form.

    HOWEVER, the mail function needs 4 values:
    to (who it's sent to)
    subject
    body (text, etc.)
    and special headers, such as from, reply-to, special encoding, etc.

    For example, here's a simple setup--
    your form on page1:
    <form action="TYPETHENAMEOFYOURNEXTPAGEHERE.php" method="post">
    <input type="hidden" value="some@one.com" name="to">
    <input type="text" name="subject">
    <textarea name="body"></textarea>
    <input type="submit">
    </form>

    Note that you should add labels next the inputs so the user knows what they do.

    Now, on your next page, which does NOT need to be nextpage.php, but rather WHATEVER you want, as long as it matches the action of the form, do this....
    PHP Code:
    <?php
    if (isset($_POST['to'], $_POST['subject'], $_POST['body'])) {
    mail($_POST['to'], $_POST['subject'], $_POST['body']);
    ?>
    ALL that does is check if the fields weren't blank when submitted, then sends an email to the person from the to field, with the subject from the subject field and with a message from the body field.
    There is no security validation or anything complex to the message.
    You can do a lot more if you want.
    Just look at php.net for the BASIC ways to manipulate strings (aka text variables)

    Also, the mail function supports extra things, like the from attribute, and reply-to and other things.
    Look at php.net for more info.


    ------------------------
    However, if all you want is a free form mailer.... look here.... use google....
    http://www.google.com/search?q=form+mailer
    look for something hosted on their server that you connect to using the action (use THEIR page as the next page)
    maybe this http://www.hostedscripts.com/formmailer.html
    ------------------------
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #15
    Join Date
    Sep 2006
    Location
    Fairfield California!
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    great thanks man for that makes since... for the most part, but I think Ill get it thanks for all your help!! If i have anymore questions or i get stuck be ready...lol thanks again!!!

  6. #16
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Sure.

    php is confusing at first, but it ends up making sense. Really, this stuff isn't complicated. it's just new.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  7. #17
    Join Date
    Sep 2006
    Location
    Fairfield California!
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    so i found out that my server doesn't understand php so im going to try the mailer way. I got a mailer and have it all set up and have it set up to send there but for some reason I get this message when I tried to test it...




    I thought I did it right?

  8. #18
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Two possibilities:
    1. Something, like you password, was wrong when you set it up. Fix that. Not sure how. Just follow the directions.
    2. If that doesn't work, just find another mailer. there are plenty.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  9. #19
    Join Date
    Sep 2006
    Location
    Fairfield California!
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    SWEET it works now!! I was missing a few codes that where need. such as where it needs to be sent my email and another type of routing number! thanks so much for all the help!!!!

  10. #20
    Join Date
    Sep 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    You can use this site i'm part of:
    http://www.formlogix.com
    It enables you to create forms quickly and easily, publish them and then manage the data entered.
    this tool is completely free and it hides all the "complicated" stuff needed to create and manage form data

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
  •