Jump to content

simple form from 2011 by Ryan still good?


wishbone
 Share

Recommended Posts

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 by Jan Romero
added missing single quotes
Link to comment
Share on other sites

  • 2 weeks later...

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!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...