"$name <$email>", 'Sender' => $sender, 'Return-Path' => $sender, 'MIME-Version' => '1.0', 'Content-Type' => 'text/plain; charset=UTF-8; format=flowed; delsp=yes', 'Content-Transfer-Encoding' => '8Bit', 'X-Mailer' => 'Hugo - Zen', ]; $mime_headers = []; foreach ($headers as $key => $value) { $mime_headers[] = "$key: $value"; } $mail_headers = join("\n", $mime_headers); // Send the mail, suppressing errors and setting Return-Path with the "-f" option. $success = @mail($to, $subject, $message, $mail_headers, '-f' . $sender); } $status = $success ? 'submitted' : 'error'; $contact_form_url = strtok($_SERVER['HTTP_REFERER'], '?'); // Redirect back to contact form with status. header('Location: ' . $contact_form_url . '?' . $status, TRUE, 302); exit; function _contact_ff_wrap(&$line) { $line = wordwrap($line, 72, " \n"); } function _contact_clean_str($str, $quotes, $strip = false, $encode = false) { if ($strip) { $str = strip_tags($str); } $str = htmlspecialchars(trim($str), $quotes, 'UTF-8'); if ($encode && preg_match('/[^\x20-\x7E]/', $str)) { $str = '=?UTF-8?B?' . base64_encode($str) . '?='; } return $str; }