+ Reply to Thread
Results 1 to 5 of 5

Thread: Formmail.php problem

  1. #1
    Join Date
    Dec 2007
    Posts
    3
    WHB Points this Month
    0.00
    WHB Points
    0.00
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Formmail.php problem

    Hello, I am having some difficulties with a PHP contact form and I was hoping someone could give me some advice to get through this problem.

    In the past I've used formmail.php in an HTML site and it worked fine, but now I want to use it in a Flash site and I can't make it work. I tested the site in another server and it works, so I thought that maybe there was a problem with the permissions, but I couldn't find anything wrong there. This is the programming I'm using:

    In Flash:
    bEnviar.onRelease = function() {
    if (nom.length<1) {
    mensaje_error = "Por favor ingrese su nombre.";
    } else if (!mail.text.isMail()) {
    mensaje_error = "Por favor ingrese un e-mail valido.";
    } else {
    loadVariablesNum("form.php", 0, "POST");
    limpiar();
    mensaje_error = "Gracias!";
    }
    };

    The PHP code:
    <?
    $to = "info@mydomain.com";
    $subject = "subject";
    $msg .= "$nom, le envia el siguiente mensaje:\n\n";
    $msg .= "E-mail: $mailfrom\n";
    $msg .= "Comments: $body\n";
    mail($to, $subject, $msg, "From:". $mailfrom);

    sleep(3);
    ?>

    Please, if anyone can help me out I would appretiate it a lot!

    Thanks in advance!

  2. #2
    omniuni's Avatar
    omniuni is offline Jewbergeek!
    Join Date
    Jul 2007
    Posts
    181
    WHB Points this Month
    0.00
    WHB Points
    0.00
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Where do you create your variables?

    For example, you use "$body" but I do not see where you initially have

    <?php
    $body = "My eMail Body"
    ?>
    [URL="http://d-site.net"]http://d-site.net/[/URL]

  3. #3
    Join Date
    Dec 2007
    Posts
    3
    WHB Points this Month
    0.00
    WHB Points
    0.00
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    In the contact form in Flash I have three input text fields: name, email and comment. Each one has a different variable assigned: $nom, $mailfrom and $body respectively.

  4. #4
    omniuni's Avatar
    omniuni is offline Jewbergeek!
    Join Date
    Jul 2007
    Posts
    181
    WHB Points this Month
    0.00
    WHB Points
    0.00
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Make sure that the "from" email address exists on the server. WHB's spam protection won't let you send a mail without a valid sending address. I recommend creating "generic@[website].com" or something similar. You don't need to use it, of course, just have it. "noreply@[website].com" is also a popular option.
    [URL="http://d-site.net"]http://d-site.net/[/URL]

  5. #5
    Join Date
    Dec 2007
    Posts
    3
    WHB Points this Month
    0.00
    WHB Points
    0.00
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Problem solved!!! Thank you very much!!!

    Following your last advice I created the email address noreply@mydomain.com and after updating the code I started receiving the emails from the contact form, but they were all blank. The variables of the text fields were not being read by the formmail.php. So I modified the code a little bit and now it works fine.

    Maybe someone can find this useful so I'll post the working code here:

    <?
    $to = "info@mydomain.com";
    $subject = "Contact from the web";
    $msg .= "$_POST[nom] wrote:\n\n";
    $msg .= "E-mail: $_POST[mailfrom]\n";
    $msg .= "Comments: $_POST[body]\n";
    mail($to, $subject, $msg, "From:". "noreplay@mydomain.com");

    sleep(3);
    ?>

+ Reply to Thread

Tags for this Thread

Posting Permissions

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