Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: Emailing Forms

  1. #1
    Regular Coder adarshakb's Avatar
    Join Date
    Jun 2009
    Location
    Silicon valley of india
    Posts
    247
    Thanks
    11
    Thanked 1 Time in 1 Post

    Smile Emailing Forms

    I learnt that i could email a form to myself using the mail() function but i get the following error. can any one please help?
    thanks a lot in advance

    PHP Code:
    Warningmail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:aduDocsTestSiteform to mail.php on line 23 
    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    <link href="styles for content form.css" rel="stylesheet" type="text/css" />
    </head>

    <body>
    <?php

    if(array_key_exists('Submit',$_POST))
    {
    //code goes here
    $to="adarshakb@gmail.com";
    $name=$_POST['Name'];
    $email=$_POST['EmailID'];
    $comm=$_POST['Comments'];
    $mail="Name:".$name."\nEmail:".$email."\nComments:\n".$comm;

    echo 
    "you submitted the array $mail";

    mail($to,"WOOT",$mail,"Thanks");//$to,"WOOT",$mail);
    }
    ?>
    <form id="form1" name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
      <p>
        <label for="Name">Name</label>
        <input name="Name" type="text" id="Name" />
        </label>
      </p>
      <p>
        <label for="EmailID">Email ID:</label>
        <input name="EmailID" type="text" id="EmailID" value="<?php echo isset($_POST['EmailID'])?$_POST['EmailID']:' '?>" />
        </label>
      </p>
      <p>
        <label for="Comments"></label>
      </p>
      <p></label>
        <label for="textarea">Comments<br />
        </label>
        <textarea name="Comments" id="textarea" cols="60" rows="30"></textarea>
      </p>
      <p>
        <label for="Submit">Submit</label>
        <input type="submit" name="Submit" value="Submit" id="Submit" />
      </p>
    </form>
    <p>&nbsp;</p>
    </body>
    </html>
    Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.

    Albert Einstein
    -----------------------------------------------------
    My Blog songs

  • #2
    Regular Coder adarshakb's Avatar
    Join Date
    Jun 2009
    Location
    Silicon valley of india
    Posts
    247
    Thanks
    11
    Thanked 1 Time in 1 Post
    i corrected a mistake in the php.ini file i made while server configuration but now a new error
    PHP Code:
    Warningmail() [function.mail]: Failed to connect to mailserver at "localhost" port 25verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:aduDocsTestSiteform to mail.php on line 23 
    but the content of my php.ini file on local system is

    [mail function]
    ; For Win32 only.
    SMTP = smtp.google.com
    smtp_port = 25

    ; For Win32 only.
    sendmail_from = adarshakb@gmail.com
    Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.

    Albert Einstein
    -----------------------------------------------------
    My Blog songs

  • #3
    Regular Coder adarshakb's Avatar
    Join Date
    Jun 2009
    Location
    Silicon valley of india
    Posts
    247
    Thanks
    11
    Thanked 1 Time in 1 Post
    oops as some one pointed it to me.. changed the code to

    [mail function]
    ; For Win32 only.
    SMTP = smtp.gmail.com
    smtp_port = 25
    Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.

    Albert Einstein
    -----------------------------------------------------
    My Blog songs

  • #4
    Regular Coder adarshakb's Avatar
    Join Date
    Jun 2009
    Location
    Silicon valley of india
    Posts
    247
    Thanks
    11
    Thanked 1 Time in 1 Post
    but still the error comes
    Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\aduDocs\TestSite\form to mail.php on line 23
    Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.

    Albert Einstein
    -----------------------------------------------------
    My Blog songs

  • #5
    Regular Coder adarshakb's Avatar
    Join Date
    Jun 2009
    Location
    Silicon valley of india
    Posts
    247
    Thanks
    11
    Thanked 1 Time in 1 Post
    but it worked on the server.. i uploaded to http://www.caffinc.com/feedback.php
    Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.

    Albert Einstein
    -----------------------------------------------------
    My Blog songs

  • #6
    Regular Coder adarshakb's Avatar
    Join Date
    Jun 2009
    Location
    Silicon valley of india
    Posts
    247
    Thanks
    11
    Thanked 1 Time in 1 Post
    noreply ? can any one solve the proble on my system?
    Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.

    Albert Einstein
    -----------------------------------------------------
    My Blog songs

  • #7
    Regular Coder godofreality's Avatar
    Join Date
    Jan 2009
    Posts
    234
    Thanks
    1
    Thanked 15 Times in 15 Posts
    not too sure but i think your local server has to be online for it to send out to the internet otherwise u r just working offline and nothing will be sent out but again i could be wrong
    woot found the avatar options...i swear they didn't exist b4


  •  

    Posting Permissions

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