comparison submit_comment.php @ 112:cf31bf5fce72 default tip

Author of the blog post as mail header for efficient spam filtering
author Dirk Olmes <dirk.olmes@codedo.de>
date Tue, 06 Sep 2022 07:04:11 +0200
parents a30aee3f6158
children
comparison
equal deleted inserted replaced
111:bb513b8b0caf 112:cf31bf5fce72
15 $slug = get_slug(); 15 $slug = get_slug();
16 16
17 $author = htmlspecialchars($_POST['Author']); 17 $author = htmlspecialchars($_POST['Author']);
18 $comment = htmlspecialchars($_POST['Comment']); 18 $comment = htmlspecialchars($_POST['Comment']);
19 $date = date('Y-m-d H:i:s'); 19 $date = date('Y-m-d H:i:s');
20 $header = 'X-Comment-Author: ' . $author;
20 21
21 $message = 'Author: ' . $author . PHP_EOL 22 $message = 'Author: ' . $author . PHP_EOL
22 . 'Date: ' . $date . PHP_EOL . PHP_EOL 23 . 'Date: ' . $date . PHP_EOL . PHP_EOL
23 . $comment; 24 . $comment;
24 25
25 $subject = 'New blog post comment on article ' . $slug; 26 $subject = 'New blog post comment on article ' . $slug;
26 mail($recipient, $subject, $message); 27 mail($recipient, $subject, $message, $header);
27 28
28 ?> 29 ?>
29 30
30 <html> 31 <html>
31 <head> 32 <head>