Php form and mail handling

I am trying to create a php form and I can get it to spit out the information from the form but I cannot seem to get it to send the result as an email.
This is probably something really simple and I am totally missing it.
Here is the form:
<form method="post" action="sendail.php">               
  <?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>
  <input type="hidden" name="ip" value="<?php echo $ipi ?>" />
  <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
  <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
        <p>I need:<span class="redStar">*</span>
          <input type= "radio" name = "need" value = "service" />service.
        <input type= "radio" name = "need" value = "sales" />to contact a salesperson.
        <input type= "radio" name = "need" value = "literature" />to have literature sent to me.<br />
        Name:        <input type = "text" name = "name" size = "30" />
        <span class="redStar">*</span><br />
        Title:           <input type = "text" name = "title" size = "30" /><br />
        Company: <input type = "text" name = "company" size = "30" /></p>
        <p>Address 1: <input type = "text" name = "address1" size = "30" />
          <span class="redStar">*</span><br />
        Address 2: <input type = "text" name = "address2" size = "30" /><br />
        City: <input type = "text" name = "city" size = "30" />
        <span class="redStar">*</span> State: <input type = "text" name = "state" size = "3" />
        <span class="redStar">*</span> Zip: <input type = "text" name = "zip" size = "11" />
        <span class="redStar">*</span></p>
       <p>Email:   <input type = "text" name = "email" size = "30" />
         <span class="redStar">*</span><br />
        Phone: <input type = "text" name = "phone" size = "30" />
        <span class="redStar">*</span> </p>
        <p><input type = "submit" name = "submit" value = "Submit" /></p>
        <p><span class="redStar">*</span> These blanks must be filled in</p>
</form>       
and here is the page that handles the form (with the exception of the referring page, and other environmentals:
        <?php
        $ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
        $need = $_POST['need'];
        $name = $_POST['name'];
        $title = $_POST['title'];
        $company = $_POST['company'];
        $address1 = $_POST['address1'];
        $address2 = $_POST['address2'];
        $city = $_POST['city'];
        $state = $_POST['state'];
        $zip = $_POST['zip'];
        $email = $_POST['email'];
        $phone = $_POST['phone'];
if(!$email == "" && (!strstr($email,"@") || !strstr($email,".")))
echo "<h2>Use Back - Enter valid email</h2>\n";
$badinput = "<h2>Your form was NOT submitted</h2>\n";
echo $badinput;
die ("Go back! ! ");
if(empty($name) || empty($email) || empty($address1) || empty($city) || empty($state) || empty($zip) || empty($phone)) {
echo "<h2>Use your Back button - fill in all starred fields, your form was not submitted.</h2>\n";
die ("Use back! ! ");
$todayis = date("l, F j, Y, g:i a") ;
$subject = Contact_From_Website;
$message = " $todayis [EST] \n
From: $name ($email)\n
Title: $title\n
Company: $company\n
Telephone: $phone ($phone)\n
Address: $address1\n
$address2\n
City: $city\n
State: $state\n
Zip: $zip\n
Phone: $phone\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
$from = "From: $email\r\n";
mail("[email protected]", $name, $title, $company, $phone, $address1, $address2, $city, $state, $zip, $email, $phone, $ip, $httpref);
/* This is the part that emails everyone and is commented out for testing
if ($need = "service") {
    mail("[email protected]", $name, $title, $company, $phone, $address1, $address2, $city, $state, $zip, $email, $phone, $ip, $httpref);
mail("[email protected]", $need, $name, $title, $company, $phone, $address1, $address2, $city, $state, $zip, $email, $phone, $ip, $httpref);
    if ($need = "sales") {
    mail("[email protected]", $need, $name, $title, $company, $phone, $address1, $address2, $city, $state, $zip, $email, $phone, $ip, $httpref);
        mail("[email protected]", $need, $name, $title, $company, $phone, $address1, $address2, $city, $state, $zip, $email, $phone, $ip, $httpref);
    if ($need = "literature") {
        mail("[email protected]", $need, $name, $title, $company, $phone, $address1, $address2, $city, $state, $zip, $email, $phone, $ip, $httpref);
mail("[email protected]", $need, $name, $title, $company, $phone, $address1, $address2, $city, $state, $zip, $email, $phone, $ip, $httpref);
        ?>
        Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $name ?> ( <?php echo $email ?> )  <?php echo $title ?> <?php echo $company ?> <?php echo $phone ?> <?php echo $address1 ?> <?php echo $address2 ?> <?php echo $city ?> <?php echo $state ?> <?php echo $zip ?>
<br /> You have requested <?php echo $need ?>
<br /> Your IP Address has been recorded for your safety.
<?php echo $ip ?>
You can see where I am trying to go with this. I want to use the $need variable to determine where the email is going to go (two people in each case). But I am testing this script and cannot get to send me an email without any if statements.
Where have I gone wrong?

60251977 wrote:
> I'm considering switching to Wordpress but have started
building a site in
> Dreamweaver, and am not especially keen on having to
learn an entirely new
> program.
If you're not keen on learning, you might want to reconsider
your plans.
Creating a simple web page is easy, giving many beginners the
false
impression that website development is something anyone can
do without
acquiring specialist knowledge.
> I want to create a simple "Add Comment" form so that
when a visitor to my site
> wants to comment, he can do so, press submit, and the
page refreshes with his
> comments inserted. Just like a blog.
Yep, sounds simple enough, but so is turning the ignition key
of a car.
What you're ignoring is the underlying technology that not
only makes it
work, but makes it work safely. WordPress does all of this
for you
straight out of the box. To build it successfully in
Dreamweaver
requires a knowledge of PHP, MySQL, and SQL.
> According to the Pickaweb FAQ, the path to PHP is
"/usr/bin/php"
If PHP is enabled on your site, the path to PHP is
irrelevant.
> If my site was called elephantlike.co.uk, what would I
enter into the Action
> field of the form wizard?
> Would this make my form work? Or is there other stuff I
need to know?
What you enter in the Action field is the path to the script
that
processes the form input. If you're willing to learn the
basics of PHP,
MySQL, and SQL, you can create a comment form on your site
with
Dreamweaver. However, you need to be aware of security
issues, such as
cross-site scripting and dealing with spam. What looks simple
at first
glance is actually more complex. It's not rocket science, but
it does
involve a learning curve.
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS4",
"PHP Solutions" & "PHP Object-Oriented Solutions"
http://foundationphp.com/

Similar Messages

  • PHP form and image verification

    Does anybody know where I can download a free formMail plus
    image verification?
    Thanks

    > Thanks looks really good
    >
    > Does the second php script go on my server? What name do
    I give it?
    All code goes into the same page. That page has to have an
    php extension
    so name your page something like contact.php" and then you
    paste the php
    (PHP code) at the very top of your document. Then paste the
    html/php
    (HTML form) where you want your form to display.
    You're welcome to mail me at kim *at* geekministry *dot* com
    if you get
    into troubles :)
    Kim
    http://www.geekministry.com

  • PHP form to output in PDF

    I was wondering if there is a php function or some type of
    code where you can make a php form and when the user clicks on a
    button it transfers their information to another page which opens
    up and displays it in PDF in the web browser. I remember seeing
    this done under Coldfusion MX, is there something similar for it in
    PHP?

    AdonaiEchad wrote:
    > I was wondering if there is a php function or some type
    of code where you can
    > make a php form and when the user clicks on a button it
    transfers their
    > information to another page which opens up in PDF.
    Look for example at fpdf (
    http://www.fpdf.org/) or ezpdf
    http://www.ros.co.nz/pdf/).
    Leolux

  • PHP form handler

    Hi,
    I've found a PHP form handler in one of the forums to process my feedback page. All works well but one thing I can't work out is when a visitor to the site fills in the info and clicks the submit button, that comes back to my mail box as expected but if I want to reply to this email the site's email address always comes up in the "To" field rather than the viewer's email address, is there anyway to change this?  I've trawled the forums but can't find an answer, have included the php code if anyone has any suggestions.
    Thanks in advance.
    <?php
    if (!empty($HTTP_GET_VARS)) while(list($name, $value) =
    each($HTTP_GET_VARS)) $$name = $value;
    if (!empty($HTTP_POST_VARS)) while(list($name, $value) =
    each($HTTP_POST_VARS)) $$name = $value;
    $contact_msg="Dear $contact,
    Thank you for taking the time to contact My Comany via our web site.
    Your request has been received and will contact you ASAP.
    Regards
    My Company
    http://www.mycompany.co.nz
    mailto:[email protected]
    mail("$eMail","Contact Form","$contact_msg","From: My Company <[email protected]>");
    $contact_copy="
    ------------ My Company request information form --------------
    The following person has filled out the contact form:
    -- CUSTOMER DETAILS
    First Name: $contact
    Last Name address: $lastName
    Company: $company_Name
    Phone Number: $phone_Number
    email: $eMail
    Questions: $questions
    -- !END OF FORM --------------------------------------------
    mail("[email protected]","Contact Form","$contact_copy","From: My Company <[email protected]>");
    ?>

    Thanks for posting this useful information. I found some more at php tutorial.

  • Why is my php form not sending to my e-mail?

    Here i have the code for my .php document and the code for my html. Why is the form not sending to my e-mail ([email protected])? At one point I had the form sending to my e-mail, but the information that was filled out was not appearing. Now no email is being sent at all. I tried a contact-us.php page with the php email code in the same document and now have the information in seperate documents, but I am getting the same results every which way. I need help I have been checking this over for hours and looking up solutions online but it all is very confusing. PLEASE HELP!
    send.php
    <?php
    if ($_POST['parse_var'] == "contactForm") {
              $emailTitle = 'Scheduele In Home Consultation or General Question';
              $yourEmail = '[email protected]';
              $firstName = $_POST['FirstName'];
              $lastName = $_POST['LastName'];
              $phoneNumber = $_POST['PhoneNumber'];
              $emailAddress = $_POST['EmailAddress'];
              $Message = $_POST['Message'];
              $body = <<<EOD
    <br><hr><br>
              First Name: $firstName <br />
              Last Name: $lastName <br />
              Phone Number: $phoneNumber <br />
              Email Address: $emailAddress <br />
              Message: $Message <br />
    EOD;
              $headers = "From: $emailAddress\r\n";
              $headers .= "Content-type: text/html\r\n";
              $success = mail("$yourEmail", "$emailTitle", "$body", "$headers");
              $sent = "Thank you! Your message has been sent.";
    ?>
    contact-us.html
          <form action="send.php" method="post" name="contactForm" id="contactForm">
            <table width="75%" align="left" cellpadding="5" id="contactustable">
              <tr>
                <td><label for="FirstName"></label>
                  <span id="sprytextfield1">
                  First Name<br>
                  <br>
                  <input type="text" name="FirstName" id="FirstName" value="<?php print "$firstName"; ?>">
                <span class="textfieldRequiredMsg">Please enter your first name.</span></span></td>
              </tr>
              <tr>
                <td> </td>
              </tr>
              <tr>
                <td><label for="LastName"></label>
                  <span id="sprytextfield2">
                  Last Name<br>
                  <br>
                  <input type="text" name="LastName" id="LastName" value="<?php print "$lastName"; ?>">
                <span class="textfieldRequiredMsg">Please enter your last name.</span></span></td>
              </tr>
              <tr>
                <td> </td>
              </tr>
              <tr>
                <td><label for="PhoneNumber"></label>
                  <span id="sprytextfield3">
                  Phone Number<br>
                  <br>
                  <input type="text" name="PhoneNumber" id="PhoneNumber" value="<?php print "$phoneNumber"; ?>">
    <span class="textfieldInvalidFormatMsg">Please enter your phone number.</span></span></td>
              </tr>
              <tr>
                <td> </td>
              </tr>
              <tr>
                <td><label for="EmailAddress"></label>
                  <span id="sprytextfield4">E-mail Address<br>
                  <br>
                  <input type="text" name="EmailAddress" id="EmailAddress" value="<?php print "$emailAddress"; ?>">
                <span class="textfieldRequiredMsg">Please enter your e-mail address.</span><span class="textfieldInvalidFormatMsg">Example: [email protected].</span></span></td>
              </tr>
              <tr>
                <td> </td>
              </tr>
              <tr>
                <td height="255"><label for="Message"></label>
                  <span id="sprytextarea1">
                  Message:<br>
                  <br>
                  <textarea name="Message" cols="85%" rows="12" id="Message"><?php print "$Message"; ?></textarea>
                <span class="textareaRequiredMsg">A value is required.</span></span></td>
              </tr>
              <tr>
                <td> </td>
              </tr>
              <tr>
                <td><input type="submit" name="Reset" id="Reset" value="Reset">
                  <input type="hidden" name="parse_var" id="parse_var">             
                <input type="submit" name="Submit" id="Submit" value="Send Message"></td>
              </tr>
              <tr>
                <td><?php print "$sent"; ?></td>
              </tr>
            </table>
          </form>

    tonyb1117 wrote:
    It works! Thank you very much for pointing that out "bregent" and "osgood_". I have one more small problem though, when signing out my contact form the phone number field does not accept any phone number?
                  <input type="text" name="PhoneNumber" id="PhoneNumber" value="<?php print "$phoneNumber"; ?>">
    <span class="textfieldInvalidFormatMsg">Please enter your phone number.</span></span></td>
    Any solutions?
    I don't know anything about Spry validation of form fields but I think it requires you to set the type of validation, i.e., text, email, number.
    Have you looked in that direction.
    I presume what youre saying is when you hit send you get a red message saying phone number is not valid or something along those lines?

  • Need help with PHP form with checkboxes, radio buttons and file attachment

    Hi guys,
    I'm having a nightmare with this PHP form where a user can fill it in, attach a doc/pdf and submit. After trying to sort it out with previous code I've used, I've stripped it out and think I should just start again in the hope you geniuses can help!
    Here is the HTML of contact.php:
    <form action="" method="post" name="contact" id="contact">
        <p>Job Title:*<br />
        <input name="position" type="text" /></p>
        <p>Nationality:*<br />
        <select name="nationality">
          <option value="">-- select one --</option>
          <option value="Afghan">Afghan</option>
          <option value="Albanian">Albanian</option>
          <option value="Algerian">Algerian</option>
          <option value="Zambian">Zambian</option>
          <option value="Zimbabwean">Zimbabwean</option>
        </select>
        </p>
        <p>Which country are you currently living in?*<br />
        <select name="country">
        <option value="">-- select one --</option>
        <option value="United Kingdom">United Kingdom</option>
        <option value="Afghanistan">Afghanistan</option>
        <option value="Africa">Africa</option>
        <option value="Zambia">Zambia</option>
        <option value="Zimbabwe">Zimbabwe</option>
        </select>
        </p>
        <label class="radio" for="checkRight">Yes/No question?</label><br />
        <input class="radio" type="radio" name="right" value="Yes" /> Yes
        <input class="radio" type="radio" name="right" value="No" /> No
        <input class="radio" type="radio" name="right" value="N/A" /> Not applicable
        <p>Yes/No question?<br />
        <select name="continue">
        <option value="">-- select one --</option>
        <option value="Yes">Yes</option>
        <option value="No">No</option>
        </select>
        </p>
        <p>Select your resorts:<br />
        Resort 1<input name="res1" type="checkbox" value="Resort 1" />
        Resort 2<input name="res2" type="checkbox" value="Resort 2" />
        Resort 3<input name="res3" type="checkbox" value="Resort 3" />
        Resort 4<input name="res4" type="checkbox" value="Resort 4" />
        Resort 5<input name="res5" type="checkbox" value="Resort 5" />
        Resort 6<input name="res6" type="checkbox" value="Resort 6" />   
        </p>
        <p>Don't send form unless this is checked:* <input type="checkbox" name="parttime" value="Yes" /></p>
        <p>Date of arrival: <input name="arrive" id="datepick" /><br />
        Date of departure: <input name="depart" id="datepick2" /></p>
        <script type="text/javascript" src="assets/scripts/datepickr/datepickr.js"></script>
        <link href="assets/scripts/datepickr/datepickr.css" rel="stylesheet">
        <script type="text/javascript">
        new datepickr('datepick');
        new datepickr('datepick2', {
        </script>
        <p>Name:*<br />
        <input name="name" type="text" /></p>
        <p>E-mail:*<br />
        <input name="email" type="text" /></p>
        <p>Telephone:*<br />
        <input name="telephone" type="text" class="ctextField" /></p>
        <p>Upload CV (Word of PDF formats only):<br />
        <input type="file" name="cv" class="textfield"></p>
        <p><input name="submit" value="Submit Enquiry" class="submitButton" type="submit" /><div style="visibility:hidden; width:1px; height:1px"><input name="url" type="text" size="45" id="url" /></div></p>
    </form>
    By the way, the date boxes work so excuse the Javascript in there!
    To prevent SPAM I've used a trick where there's a hidden URL field which must be left blank for the form to submit which you can see in the PHP.
    Below is where I'm at with the PHP which is placed above the header of contact.php...
    <?php
    if (array_key_exists('submit', $_POST)) {
        $position = $_POST['position'];
        $arrive = $_POST['arrive'];
        $nationality = $_POST['nationality'];
        $parttime = $_POST['parttime'];
        $depart = $_POST['depart'];
        $name = $_POST['name'];
        $email = $_POST['email'];
        $telephone = $_POST['telephone'];
    $to = "[email protected]";
    $subject = "Recruitment Application";
    $message = $headers;
    $message .= "Name: " . $_POST["name"] . "\r\n";
    $message .= "E-mail: " . $_POST["email"] . "\r\n";
    $headers  = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "Reply-To: " . $_POST["email"] . "\r\n";
    $headers .= 'From: My Website <[email protected]>' . "\r\n";
    $message= "
    $url = stripslashes($_POST["url"]);
    if (!empty($url)) {
    header( 'Location: http://www.go-away-spam-robots.com' );
    exit();
    if (!isset($warning)) {
    mail($to, $subject, $message, $headers);
    header( 'Location: http://www.mywebsite.co.uk/sent.php' );
    ?>
    I would like to make pretty much all the field compulsory so if a field is left empty (other than the hidden URL field), a warning message is displayed next to that field.
    Also I would like the file upload field to attach to the email that is sent to me and have the results come through to me in a table format.
    Can anyone help me get my form working?
    Thank you and I hope to hear from you!
    SM

    Hi Nancy,
    Great stuff, thank you for the reply.
    I've managed to get the Formm@iler working and running as I need it to.
    The only thing I'm struggling with is when the user clicks submit, they are taken to a page of whatever results the form returned but it is just a white background with Times New Roman text.
    How can I have it so the user is taken to the form results in the websites' page layout?
    I tried sending them to a generic 'thank you' page by adding the following code but it just took them there whatever the results of the form so that's no good...! I have a feeling it's a bit more complicated than that...
    header( 'Location: http://www.nofussbus.co.uk/test/sent.php' );
    Thank you for your help!

  • AS2 contact form and php - works fine but only sends half of the text in the comments field ???

    hi all - i have an AS2 contact form using php to send the info to my email address - it all works fine except this ..... rather than having an empty comments box in the flash movie i had added a whole bunch of feedback questions that the user can comment yes/no to in the comments box (my feedback questions were added into the input text box in cs3 so are there when the user opens the contact page .. i have set the maximum characters to 10000 so no worries that its that that is stopping it all coming through in the email ..... basically when i go to my form online and send it i get it through as an email but with only three quarters of the feedback text in it ...... i have tried a zillion ways a round this, tried other contact forms and php and always end up with the same problem ... any ideas any one ?
    this is the AS....
    stop();
    a =0;
    function validate () {
        if (from.length>=7) {
            if (from.indexOf("@")>0) {
                if ((from.indexOf("@")+2)<from.lastIndexOf(".")) {
                    if (from.lastIndexOf(".")<(from.length-2)) {
                        a = 1;
                        // email is fine
    function formcheck () {
        validate ();       
        trace(a);
        if (fname = "" or telno eq "" or comments eq "" or from eq "") {
            stop();
            error = "You have left blank fields, please fill in all fields, thank you";
        } else {
            emailcheck ();
    function emailcheck (){
        if (a != 1){
            stop();
            error = "Email address not valid";
            } else {
            loadVariablesNum("mail.php3", 0, "POST");
            gotoAndStop(2);
    ..........this is the php
    <?php
    $adminaddress = "[email protected]";
    $sitename = "Flash Site Form Mailer";
    mail("$adminaddress","Info Request",
    "A customer at $sitename has made the following enquiry\n
    First Name: $name
    Company Name: $company
    Telephone: $telno
    Email: $from\n
    The visitor commented:
    $comments
    Logged Info :
    Using: $HTTP_USER_AGENT
    Hostname: $ip
    IP address: $REMOTE_ADDR
    Date/Time:  $date","FROM:$adminaddress");
    ?>
    any help much appreciated

    i think you should not use $HTTP_USER_AGENT.
    and use loadvars instead of loadvariablesnum:
    stop();
    a =0;
    function validate () {
        if (from.length>=7) {
            if (from.indexOf("@")>0) {
                if ((from.indexOf("@")+2)<from.lastIndexOf(".")) {
                    if (from.lastIndexOf(".")<(from.length-2)) {
                        a = 1;
                        // email is fine
    function formcheck () {
        validate ();       
        trace(a);
        if (fname = "" or telno eq "" or comments eq "" or from eq "") {
            stop();
            error = "You have left blank fields, please fill in all fields, thank you";
        } else {
            emailcheck ();
    var sendLV:LoadVars=new LoadVars();
    function emailcheck (){
        if (a != 1){
            stop();
            error = "Email address not valid";
            } else {
    sendLV.name=fname;
    sendLV.telno=telno;
    sendLV.company=company;  //assuming company is a variable in your flash
    sendLV.comments=comments;
    sendLV.send("mail.php3", "POST");
            gotoAndStop(2);
    //..........this is the php
    <?php
    $adminaddress = "[email protected]";
    $sitename = "Flash Site Form Mailer";
    $from=?;//you need to define this variable
    $name=$_POST['name'];
    $telno=$_POST['telno'];
    $company=$_POST['company'];
    $comments=$_POST['comments'];
    $body=
    "A customer at $sitename has made the following enquiry\n
    First Name: $name
    Company Name: $company
    Telephone: $telno
    Email: $from\n
    The visitor commented:
    $comments";
    mail($adminaddress,"Info Request",$body);
    ?>

  • PHP and Mail

    I wanted to share with the community a work around we have developed for using the mail function within PHP when compiled with NSAPI (Iplanet SunOne).
    Quick summary of the problem.
    Description:
    mail() stops working a few minutes after Sunone 6 web server starts,
    which makes this look like a resource problem...
    Config line: "./configure --with-mysql=/usr/local/mysql
    --with-nsapi=/home/netscape/servers --enable-track-vars --enable-libgcc
    --with-ldap"
    Note that mail() does work briefly after web server is restarted so it
    doesn't seem to be a configuration problem.
    Reproduce code:
    <?php
    mail("[email protected]", "Test Subject", "Test Body");
    ?>
    Expected result:
    expect to receive an email
    Actual result:
    no email received
    I get no php or system errors but the following error shows up in the
    IPlanet logs:
    "trying to GET /is/sys
    net/test/email.php, php4_execute reports: PHP Warning: mail(): Could
    not execute
    mail delivery program '/usr/lib/sendmail -t'"
    Solution:
    Here's a solution that appears to work for us so far. It might be nice
    if the php developers would consider a --with-sfio parameter in
    configure that took care of this. Our exec command is still broken so
    I'll probably have to do this same type of thing for that.
    1. install sfio from AT*T
    2. setenv LIBS "-L/usr/local/lib/sfio -lsfio"
    3. modify ext/standard/mail.c
    4. modify /usr/local/include/sfio/sfio.h so references to other sfio
    header files are absolute paths (if I use -I/usr/local/include/sfio to
    find the files it produces errors for files other than mail.c)
    5. run configure and compile as normal
    here's a diff or my code and the original mail.c:
    diff mail.c mail.c.orig
    23c23
    < #include </usr/local/include/sfio/sfio.h>
    #include <stdio.h>177c177
    < Sfio_t *sendmail=NULL;
    FILE *sendmail;215c215
    < sendmail = sfpopen(sendmail, sendmail_cmd, "w");
    sendmail = popen(sendmail_cmd, "w");224c224
    < sfclose(sendmail);
    pclose(sendmail);228,229c228,229
    < sfprintf(sendmail, "To: %s\n", to);
    < sfprintf(sendmail, "Subject: %s\n", subject);
    fprintf(sendmail, "To: %s\n", to);
    fprintf(sendmail, "Subject: %s\n", subject);231c231
    < sfprintf(sendmail, "%s\n", headers);
    fprintf(sendmail, "%s\n", headers);233,234c233,234
    < sfprintf(sendmail, "\n%s\n", message);
    < ret = sfclose(sendmail);
    fprintf(sendmail, "\n%s\n", message);
    ret = pclose(sendmail);This information has also been posted on the PHP forum at
    http://bugs.php.net/bug.php?id=28748
    We had a heck of a time finding much information about the exec and mail not working on Solaris so we wanted to share this with everyone. Hope it helps someone out!
    Cheers,
    Ken and David
    Kalamazoo College

    If you want to send through your mail server you will only need SMTP for sending. You can however also send through your ISP's mail server.
    As far as security goes: The most common issue is not PHP's mail function, but the web forms used to call it. If you go for one of the most common Forum SW, you should probably be OK.

  • PHP Form mail

    I used this script
    http://www.visibilityinherit.com/code/php-form-validation.php
    to produce a form and everything worked fine on my site, which I
    was using for testing. When I transferred over to the client's site
    it doesn't send the email. The error and thank you messages work,
    but no email. As I have heard that some hosts block some php files
    with the name 'formmail' I called it something else.
    I have checked and rechecked all the data and only my email
    address and the URLs for the error and thank you pages had to be
    changed, my email is correct, but still not email.
    Any ideas as to what is happening and how I can get around it
    please?
    Rosalind

    I have been sent the following information and code, but have
    not succeeded in working out where to add it. The code I am using
    is underneath. Many thanks
    - to send emails through our servers you must comply with one
    of the following rules
    a. The sending email must be from your domain
    b. The receiving email must be from your domain
    This account could/should be [email protected]
    - To avoid a wrong use of our scripts by spammers you must
    had a line before you call the “mail” functionality
    ini_set("sendmail_from", " [email protected] ");
    - Please add to the email send code a functionality
    “-f” in the fifth parameter of the function send mail
    - This is the simple configuration of sending emails in php
    <?php
    ini_set("sendmail_from", [email protected]);
    mail($email_to, $email_subject, $email_message, $headers,
    '-f'[email protected]);
    ?>
    my php code is
    <?php
    // Input Your Personal Information Here
    $mailto = '[email protected]' ;
    $from = "FormosaParadise.com" ;
    $formurl = "
    http://formosaparadise.com/correios.php"
    $errorurl = "
    http://formosaparadise.com/formmailerror.php"
    $thankyouurl = "
    http://formosaparadise.com/thankyou.php"
    // End Edit
    // prevent browser cache
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "
    GMT");
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");
    function remove_headers($string) {
    $headers = array(
    "/to\:/i",
    "/from\:/i",
    "/bcc\:/i",
    "/cc\:/i",
    "/Content\-Transfer\-Encoding\:/i",
    "/Content\-Type\:/i",
    "/Mime\-Version\:/i"
    if (preg_replace($headers, '', $string) == $string) {
    return $string;
    } else {
    die('You think Im spammy? Spammy how? Spammy like a clown,
    spammy?');
    $uself = 0;
    $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" :
    "\n" ;
    if (!isset($_POST['email'])) {
    header( "Location: $errorurl" );
    exit ;
    // Input Your Personal Information Here
    $name = remove_headers($_POST['name']);
    $email = remove_headers($_POST['email']);
    $phone = remove_headers($_POST['phone']);
    $comments = remove_headers($_POST['comments']);
    $http_referrer = getenv( "HTTP_REFERER" );
    // End Edit
    if
    (!preg_match("/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i",$email))
    header( "Location: $errorurl" );
    exit ;
    // Input Your Personal Information Here
    if (empty($name) || empty($email) || empty($phone)
    ||empty($comments)) {
    header( "Location: $errorurl" );
    exit ;
    // End Edit
    if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
    header( "Location: $errorurl" );
    exit ;
    if (get_magic_quotes_gpc()) {
    $comments = stripslashes( $comments );
    // sets max amount of characters in comments area (edit as
    nesesary)
    if (strlen($comments) > 1250) {
    $comments=substr($comments, 0, 1250).'...';
    // End Edit
    $message =
    "This message was sent from:\n" .
    "$http_referrer\n\n" .
    // Input Your Personal Information Here
    "Name: $name\n\n" .
    "Email: $email\n\n" .
    "Phone No: $phone\n\n" .
    "Comments: $comments\n\n" .
    "\n\n------------------------------------------------------------\n"
    // End Edit
    mail($mailto, $from, $message,
    "From: \"$name\" <$email>" . $headersep . "Reply-To:
    \"$name\" <$email>" . $headersep );
    header( "Location: $thankyouurl" );
    exit ;
    ?>

  • PHP Form Mail Scripts

    What is a good resource for pre-made PHP Form Mailer Scripts.
    This is for use with a website hosted on GoDaddy.
    My client has a few requirements that the GoDaddy script does
    not offer (and the script I chose from GoDaddy is uneditable). I
    know nothing about scripting but thought I could use a pre-made
    script and modify it...is that crazy thinking on my part?
    Here are the special requests from my client:
    - They'd like to see the time the form was submitted in EST
    (the GoDaddy script puts the time in military time in another time
    zone in the subject line). Can this appear in the body of the email
    as well as the subject line?
    - They'd like the form to be sent to the person submitting it
    as well as to their company
    - They would like to be able to REPLY TO the email they
    receive with the form submission and have it be addressed to the
    person submitting the form. The current script has the email
    addressed to themselves (the company) if they click REPLY TO, so
    they are replying to themselves
    - Although this has nothing to do with the Form Mailer script
    as far as I can guess, they asked that the person filling out the
    form be able to print it prior to submitting (in my opinion,
    though, if i can have a copy of the submission sent to the
    submitter, there's no reason for this). But if anyone knows how to
    do this, please let me know.
    - Finally, the client wants to know if each submission can
    have a unique tracking number assigned to it.
    Thank you all. Any feedback is appreciated.
    Richard

    Hi,
    I can without any doubt recommend Forms 2 Go:
    http://www.bebosoft.com/products/formstogo/index.php
    Very easy to use and even someone like me who don't know a
    lot of
    programming, use it extensively.
    Deon
    "RichyZee" <[email protected]> wrote in
    news:gcvkac$fcp$[email protected]:
    > What is a good resource for pre-made PHP Form Mailer
    Scripts. This is
    > for use with a website hosted on GoDaddy.
    >
    > My client has a few requirements that the GoDaddy script
    does not
    > offer (and
    > the script I chose from GoDaddy is uneditable). I know
    nothing about
    > scripting but thought I could use a pre-made script and
    modify it...is
    > that crazy thinking on my part?
    >
    > Here are the special requests from my client:
    >
    > - They'd like to see the time the form was submitted in
    EST (the
    > GoDaddy
    > script puts the time in military time in another time
    zone in the
    > subject line). Can this appear in the body of the email
    as well as the
    > subject line?
    >
    > - They'd like the form to be sent to the person
    submitting it as well
    > as to
    > their company
    >
    > - They would like to be able to REPLY TO the email they
    receive with
    > the form
    > submission and have it be addressed to the person
    submitting the form.
    > The current script has the email addressed to themselves
    (the company)
    > if they click REPLY TO, so they are replying to
    themselves
    >
    > - Although this has nothing to do with the Form Mailer
    script as far
    > as I can
    > guess, they asked that the person filling out the form
    be able to
    > print it prior to submitting (in my opinion, though, if
    i can have a
    > copy of the submission sent to the submitter, there's no
    reason for
    > this). But if anyone knows how to do this, please let me
    know.
    >
    > - Finally, the client wants to know if each submission
    can have a
    > unique
    > tracking number assigned to it.
    >
    > Thank you all. Any feedback is appreciated.
    >
    > Richard
    >
    >

  • Php form mailer/Flash help

    I have a php form that I am using with my Flash file. It
    works great so far, but I would like to get confirmation from the
    php in the Flash file, that the info has really been sent. I think
    it is already sent up in the php, but I don't know how to handle it
    in my Flash file. The php file is attached. Do I use the echo? How
    would I do that? What I want, is in my Flash file to say sending,
    until I get then feedback from the php, and then say, sent
    successfully.
    Thanks a lot for any help!

    It is all inside an ifStatment that is inside a function,
    which gets called by the button that send the form. Here is the
    full thing.
    function validateForm(tName:String, tEmail:String,
    tSubject:String, tMsg:String):Void {
    trace("validateForm was called");
    if (tName == "" || tName == undefined) {
    trace("tName if");
    this.showAlertMsg("Please enter your name");
    } else if (tEmail == "" || tEmail == undefined ||
    tEmail.indexOf("@") == -1 || tEmail.indexOf(".") == -1) {
    trace("Invalid email address: "+tEmail+" infexOf1:
    "+tEmail.indexOf("@")+" indexOf2: "+tEmail.indexOf("."));
    this.showAlertMsg("Invalid email address");
    } else if (tSubject == "" || tSubject == undefined) {
    trace("tSubject if");
    this.showAlertMsg("Please enter a subject");
    } else if (tMsg == "" || tMsg == undefined) {
    trace("tComments if");
    this.showAlertMsg("Please enter some comments");
    } else {
    trace("the else was called...");
    var send_lv = new LoadVars();
    //send_lv.onLoad = ShowStatus;
    //send_lv.EmailType = "Quote";
    send_lv.Name = tName;
    send_lv.FromEmail = tEmail;
    send_lv.Subject = tSubject;
    send_lv.Comments = tMsg;
    send_lv.status = "";
    send_lv.sendAndLoad("php/sendContact.php",result_lv,"Post");
    this.showAlertMsg("Sending...");
    var submitListener:Object = new Object();
    submitListener.click = function(evt:Object) {
    var result_lv:LoadVars = new LoadVars();
    result_lv.onLoad = function(success:Boolean) {
    if (success) {
    this.tf_showAlertMsg.text = "Thank you for sending us an
    email";
    } else {
    this.tf_showAlertMsg.text = "Email did not go through";
    function showAlertMsg(msg:String):Void {
    this.tf_showAlertMsg.text = "";
    this.tf_showAlertMsg.text = msg;
    this.send_btn.onRelease = function() {
    validateForm(tf_Name,tf_Email,tf_Subject,tf_Comments);
    I tried the new way Dave posted and it still does not get the
    echo from the form.
    Thanks so much to both of you for the help!

  • E Mail Forms and Spam Bots

    I have created a form and using a PHP script to forward the
    form results to an e mail account. How protected is this from
    harvesting the e mail address by spam bots? If this is not the best
    way to go, any suggestions on a better method. I'm familiar with
    captcha but would prefer not to have to use this.
    thnx
    Fred

    If the email address is ONLY mentioned in the PHP script,
    it's completely
    secure.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Fred1000" <[email protected]> wrote in
    message
    news:fahij6$576$[email protected]..
    >I have created a form and using a PHP script to forward
    the form results to
    >an
    > e mail account. How protected is this from harvesting
    the e mail address
    > by
    > spam bots? If this is not the best way to go, any
    suggestions on a better
    > method. I'm familiar with captcha but would prefer not
    to have to use
    > this.
    >
    > thnx
    > Fred
    >

  • PHP Form Validation and Insert Records

    Hi There,
    I've been scratching my head for 2 days and couldn't find a solution.
    Here is my problem:
    Go to http://ecopethandbags.com/contactTest.php and click the "Send Comments" button.
    You will see that the validation works.
    Now, go to http://ecopethandbags.com/contactTestInsert.php, this time, I've inserted the "Insert Record" server behavior.
    Click the "Send Comments" button again.
    You will see the ugly message like "Column 'firstname' cannot be null" in a plain white page.
    My question is:
    How can I insert the PHP form records in my database and take advantage of the form validation nicely like in http://ecopethandbags.com/contactTest.php
    I am attaching the files.
    Thank you for you help!

    boloco wrote:
    My question is:
    How can I insert the PHP form records in my database and take advantage of the form validation nicely like in http://ecopethandbags.com/contactTest.php
    Use simple PHP logic to merge the scripts together.
    Dreamweaver automatically puts the Insert Record server behavior code at the top of the script. You need to adapt it so that the validation is done first. If the validation succeeds, use the Insert Record server behavior. If not, redisplay the form.
    if (array_key_exists('send', $_POST)) {
      // validate the form input
      if (!$suspect && empty($missing)) {
      // send the mail
        if ($mailSent) {
        unset($missing);
        // insert the Insert Record server behavior code here

  • PHP files and Flash contact form

    Hello,
    I am creating a website in flash CS4 and I made a contact form and when I test the site out, I can type and click the submit button, so everything is fine there but it doesn't go to anything. Now I know I need a code to tell the contact form where to go, but I can't find one that works, or I may be doing something wrong.  I also have been reading about PHP but I am not sure what that is. I found a site that said to put this code in the actions panel.
    on(release){
        getURL("http://www.mail.menaceaudio.com", "", "POST");
    The www.mail.menaceaudio.com is the site for the companies email.
    So when I test it out this error comes up:
    1087: Syntax error: extra characters found after end of program.

    The code you show is AS2, not AS3. Try searching for 'as3 form php' and you should find plenty of info.
    PHP is a server-side scripting language. You put PHP files on your server and can then call them from Flash...

  • Safari and mail will not load but i am connected to internet and can download form itunes and other sourses is that HD failure?

    Safari and mail will not load but i am connected to internet and can download form itunes and other sourses is that HD failure?  any suggestions ?  verify disk says its OK

    iOS 4: Updating your device to iOS 5 or later - Support - Apple
    iOS: Unable to update or restore - Support - Apple
    iTunes for Windows: iTunes Store connection troubleshooting
    See if any of these three may help.

Maybe you are looking for

  • Can anyone help me identify the cause of this nick (scatch)?

    I discovered something strange this morning.....I found a nick (or scratch) at the very hidden area on the Book. It's on the very bottom side lower left corner of the screen, which seats below the "gap" area, right on top of the lower left corner of

  • The Back Arrow is not working properly in hotmail, using Firefox browser

    I have to click the back arrow twice to get it to work. And then it doesn't take me to the previous page I was on. It takes me to my In box. It was very useful when I had my messages sorted to show only "Unread Messages". Hitting the back arrow allow

  • JMF in Applet

    I have an applet that plays a video from a HTTP URL and it works fine as an application and runs fine in appletviewer. But, when the applet is run in a browser I get this error: Error instantiating class: com.sun.media.protocol.http.DataSource: java.

  • How to fix error 150:30 after download from backup

    I had a hard drive crash on my iMAC. New HD installed. Saved files back on HD. Trying to open CS4 - error code 150:30. Says to restart computer - but same error code appears and it won't open. Suggestions?

  • Wrong chinese character in place of u00B5F

    Hello All, We converted SAP 4.7 sp 63 to Unicode. During vocabulary maintenance there were 1500 collisions. for µF it was language ZH assigned. Now, after unicode conversion material description in sales order is incorrect. (i.e. PCC LP 4500礔 DC 900V