SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Oct 2010
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Simple Email Form Question

    can you guys help me with some simple questions with PHP.. i dont understand it... I am new to PHP

    i want to make a SQUEEZE PAGE; in it i need to make a PHP email form like this example:

    http://www.ibdhost.com/contact/

    where customers enter their information - it sends me an email

    so i follow the procedure,
    my question is:

    1. I do not have a domain server to test this on; so i download QUICKPHP; doesnt really work...; do i really need a domain server to test this?

    2. when the customer sends me the information, i SHOULD receive an email but from WHO? is it something like noreply@(mydomainname).com?


    thanks in advance

  2. #2
    Non-Member Kalon's Avatar
    Join Date
    Aug 2010
    Location
    At my computer
    Posts
    2,012
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You don't have to have a domain name to test php's mail().

    You can use a free local web server like XAMPP. The headers in your mail() must include a From: header which needs to be a real email address on the mail server set in your SMTP parameter in your php.ini. You can set the SMTP parameter value using ini_set() in your php script if you don't have access to your php.ini.

    You also must have SMTP enabled on on your local or "real" web server for mail() to work.

  3. #3
    SitePoint Wizard lorenw's Avatar
    Join Date
    Feb 2005
    Location
    was rainy Oregon now sunny Florida
    Posts
    1,104
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    If you try to send mail from your localhost, beware that it will get caught in every spam filter there is. Just be aware that you mailer may work but you may never get any mail.

    Since sending email from localhost is considered spammy and in most cases will not even get into the spam box. Anyway thats what happened to me. In the good old days it used to work.
    What I lack in acuracy I make up for in misteaks

  4. #4
    SitePoint Enthusiast
    Join Date
    Oct 2009
    Location
    in the eyes of a madman
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Answering you question:
    1. no, download either Xampp or WampServer.
    2. read http://us3.php.net/manual/en/function.mail.php.
    basically a regurtitaion of what Kalon said
    PHP Code:
    //of course sanitize everything that is received for user input
    //sanitize $_POST
    //setup to, message and subject
    // make sure $_POST['email'] is only one email address
    $email$_POST['email'];
    $additional_header "From: $email\r\n"
    $t mail($to$subject$message$additional_header);
    if(
    $t){
    echo 
    'sent';
    }else{
    echo 
    'failed';



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
  •