Forum Replies Created

are often better for cooling We may not necessarily be buying the concept

  • Maybe its worth adding this to an update as it is the same for all forms on all flavours in the food truck theme 🙁 thanks, Alex

    Hi Alex,

    Ive managed to fix the problem by replacing the code as follows. All is working fine now 🙂 thanks for the heads up and help.

    Alex

    <?php

    $to = “andy@andysicecream.co.uk”;
    $from = $_POST[’email’];

    $headers = “From: ” . $from . “\r\n”;

    $subject = $_POST[‘msg_subject’];
    $body = $_POST[‘msg_subject’] . “\r\n\r\n”;

    $body .= “E-mail: ” . $_POST[’email’] . “\r\n”;

    if ($_POST[‘field_’]) {
    foreach ($_POST[‘field_’] as $key => $item) {
    if ($item != ‘ ‘) {
    $body .= “Field ” . $key . “: ” . $item . “\r\n”;
    }
    }
    }

    if (filter_var($_POST[’email’], FILTER_VALIDATE_EMAIL)) {
    //here we will change ‘from’ to dynamic email
    $from = $_POST[’email’];
    if (mail($to, $subject, $body, $headers, “-f ” . $from)) {
    $message = ‘OK’;
    } else {
    $errors = ‘Error’;
    echo json_encode(array(‘errors’ => $errors));
    exit;
    }
    } else {
    $errors = ‘Error’;
    echo json_encode(array(‘errors’ => $errors));
    exit;
    }

    echo json_encode(array(‘msg’ => $message));
    exit;

    Hi Alex,

    Many thanks for this. Howver it is still selecting my email as the email i reply to when i reply in my mail client..

    A fix would be appreciated.

    Many thanks,

    Alex