Jump to content

Recommended Posts

Posted (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 by Jan Romero
added missing single quotes
  • 2 weeks later...
Posted

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!

Posted
$headers = 'From: info@selfdomain.com' . "\r\n" .
           'Reply-To: '.$email . "\r\n" .
		   'X-Mailer: PHP/' . phpversion();

This should help ?

Posted

thx, DV-JF, for looking into this!

Now Reply-To is empty...

From: info@selfdomain.com
Reply-To: 
X-Mailer: PHP/8.1.5

 

Posted
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"

?

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
  • Recently Browsing   0 members

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