widget/contact: send from given name
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 25 Jan 2021 23:05:30 +0000 (00:05 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 26 Jan 2021 00:22:41 +0000 (01:22 +0100)
Apply naam input to sender email address.

widget/contact.php

index a4fccda1a0ca8aead4f0b5f106653696cf05e043..c6e702234b8d8d00e46258d6c5952a75f0108ac2 100644 (file)
@@ -52,6 +52,9 @@ switch ($source) {
 
        $reply = preg_match('/\A[^\s\'@]{1,64}@[.a-zA-Z0-9-]{4,63}\z/', @$input['email'])
                ? $input['email'] : "noreply@$domain";
+       if ($displayname = @$input['naam']) {
+               $reply = sprintf('"%s" <%s>', addcslashes($displayname, "\\\"\0..\37"), $reply);
+       }
        $header = "From: $reply";
 
        foreach (array(