Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Web Design (WordPress, Joomla, etc.) A simple problem with forms

  • A simple problem with forms

    Posted by Paxson Woelber on April 30, 2010 at 7:33 am

    Hello all. I’ve recently tried my hand at building a form in Dreamweaver(I know, I said this was simple stuff, right?). This is obviously the easy part – getting some CGI to actually deal with the form data is proving very, very tricky (at least for me..). I’m trying to post the information to a php file, which then should send an e-mail to a gmail account. There’s a hitch somewhere, but I’m not sure what it is.

    The page with the form is:

    https://www.votemia.com/volunteer/

    The PHP code, on the file contact.php, is:

    co***************@***il.com";
    $subject = "Volunteer Request";
    $name = $_REQUEST['name'];
    $email = $_REQUEST['email'] ;
    $phone = $_REQUEST['phone'];
    $yesnewsletter = $_REQUEST['yesnewsletter'];
    $event = $_REQUEST['event'];
    $admin = $_REQUEST['admin'];
    $sign = $_REQUEST['sign'];
    $comments = $_REQUEST['comments'] ;
    $headers = "From: $email" . "\r\n";
    $headers .= "Phone : $phone" . "\r\n";
    $headers .= "Newsletter : $yesnewsletter" . "\r\n";
    $headers .= "Host an event : $event" . "\r\n";
    $headers .= "Administrative work : $admin" . "\r\n";
    $headers .= "Hold a sign : $sign" . "\r\n";
    $headers .= "Comments : $phone" . "\r\n";
    $sent = mail($to, $subject, $comments, $headers) ;
    if($sent)
    {print "Your mail was sent successfully"; }
    else
    {print "We encountered an error sending your mail"; }
    ?>

    When I try to post the form, I get this error message:

    Warning: mail() [function.mail]: SMTP server response: 550 <co***************@***il.com> No such user here in E:\inetpub\vhosts\votemia.com\httpdocs\contact.php on line 19
    We encountered an error sending your mail

    Thanks for any guidance/help/advice!

    Kelly Johnson replied 16 years ago 3 Members · 2 Replies
  • 2 Replies
  • Curtis Thompson

    April 30, 2010 at 3:27 pm

    hello…

    i’d guess it’s because you are sending your form info as mail headers as opposed to in the body of the email – here’s the php doc page:

    https://php.net/manual/en/function.mail.php

    that has some samples of what types of mail headers you could use (they are optional, though) – things like Cc, Bcc, Reply-To, etc…

    you should put all your info in the message param, which is the 3rd one…so something like this:

    $to = “costellovolunteer@gmail.com”;
    $subject = “Volunteer Request”;
    $name = $_REQUEST[‘name’];
    $email = $_REQUEST[’email’] ;
    $phone = $_REQUEST[‘phone’];
    $yesnewsletter = $_REQUEST[‘yesnewsletter’];
    $event = $_REQUEST[‘event’];
    $admin = $_REQUEST[‘admin’];
    $sign = $_REQUEST[‘sign’];

    $mail_body = “From: $email” . “\n”;
    $mail_body .= “Phone : $phone” . “\n”;
    $mail_body .= “Newsletter : $yesnewsletter” . “\n”;
    $mail_body .= “Host an event : $event” . “\n”;
    $mail_body .= “Administrative work : $admin” . “\n”;
    $mail_body .= “Hold a sign : $sign” . “\n”;
    $mail_body .= “Comments : $phone” . “\n”;
    $mail_body .= $_REQUEST[‘comments’] ;

    $sent = mail($to, $subject, $mail_body) ;

    if($sent)
    {print “Your mail was sent successfully”; }
    else
    {print “We encountered an error sending your mail”; }

    give that a shot and see if it works for you!

    sitruc

  • Kelly Johnson

    May 5, 2010 at 4:05 am

    I realize this is starting over, but after about 10 minutes of reading, 10 more of using this, you’ll be done:

    https://www.tectite.com/

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy