Jan Romero Posted June 16, 2022 Posted June 16, 2022 (edited) On 6/13/2022 at 11:07 PM, wishbone said: if (empty($input->post->email)) $error = "<p class='error'>Bitte eine E-Mail-Adresse angeben</p>"; Btw you may want to check $form['email'] instead of the raw input, because it’s sanitized. If your user enters an invalid email, your current code won’t catch it. The sanitizer will return an empty string if it doesn’t think the input is valid, so checking the sanitized value will also catch invalid input even if it’s not empty. Edited June 29, 2022 by Jan Romero added missing single quotes
wishbone Posted June 27, 2022 Author Posted June 27, 2022 problem how to set headers "from" correctly Important change due to DMARC-policies: If the user's email contains e.g. yahoo or hotmail, it will be rejected. -> "From" - never set user's email To be able to reply to the user's email nevertheless, set headers. $headers = 'From: info@selfdomain.com' . "\r\n" . 'Reply-To: $email' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); throws: "Reply-to: $email" (everything else is correct) tried: 'Reply-To: $form[email]' . "\r\n" . also only gives the string "$form[email]", doesn't run the code. $email is: $form = array( ... 'email' => $sanitizer->email($input->post->email), ... ); Where is my syntax error? thx again!
DV-JF Posted June 27, 2022 Posted June 27, 2022 $headers = 'From: info@selfdomain.com' . "\r\n" . 'Reply-To: '.$email . "\r\n" . 'X-Mailer: PHP/' . phpversion(); This should help ?
wishbone Posted June 27, 2022 Author Posted June 27, 2022 thx, DV-JF, for looking into this! Now Reply-To is empty... From: info@selfdomain.com Reply-To: X-Mailer: PHP/8.1.5
Gideon So Posted June 28, 2022 Posted June 28, 2022 Hi @wishbone Try change the following line 15 hours ago, wishbone said: 'Reply-To: $form[email]' . "\r\n" . to "Reply-To:" . $form[email] . "\r\n" . Gideon
wishbone Posted June 28, 2022 Author Posted June 28, 2022 8 hours ago, Gideon So said: "Reply-To:" . $form[email] . "\r\n" . "Fatal Error: Uncaught Error: Undefined constant "email" in \site\templates\fuehrungen.php:86" ?
Gideon So Posted June 28, 2022 Posted June 28, 2022 Hi @wishbone $form[email] should be $form['email'] Gideon 1 1
wishbone Posted June 28, 2022 Author Posted June 28, 2022 8 hours ago, Gideon So said: $form['email'] Thx Gideon! that does the trick. ? so happy now
Gideon So Posted June 29, 2022 Posted June 29, 2022 Hi @wishbone Glad that you sorted it out. Keep happy coding with ProcessWire. Gideon 3
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now