Re: Re: Anyone have a rule to detect "Dear xxx" in the body of the message where the "To:" address is xxx@domain?
Mark London <[email protected]>
| Newsgroups | gmane.mail.spam.spamassassin.general |
|---|---|
| Message-ID | <[email protected]> |
I asked ChatGPT how to test for a "Dear 'username'". After a bit of
work, I got working code. ChatGPT knows perl.
I already had a Perl file EvalTests.pm file with customized Perl eval
functions, so I threw it in there. Otherwise, you'll need to create
your own file with the proper headers.
sub check_body_for_username {
my ($self, $permsgstatus) = @_;
my $to = $permsgstatus->get('To:addr');
return 0 unless $to;
my ($username) = $to =~ /([^@]+)/;
return 0 unless $username;
# Check if the username is in the body of the email
my $body = $permsgstatus->get_decoded_stripped_body_text_array();
foreach my $line (@$body) {
if ($line =~ /^(Dear|Hi|Hello) \Q$username\E\b/i) {
return 1;
}
}
return 0;
}
header DEAR_USERNAME eval:check_body_for_username()
On 7/17/2024 11:10 PM, Grant Taylor via users wrote:
> On 7/17/24 18:04, Matija Nalis wrote:
>> I.e. would you consider it to be significantly less likely to be spam
>> if it contained "Dear Elizabeth," while being addressed to
>> "mark@domain" instead of to "elizabeth@domain" ?
>
> I've seen quite a bit of spam that opens message bodies with:
>
> <salutation> <local part>
>
> Where <salutation> is "Dear" or some other greeting, often language
> specific and <local part> is the local part of the email address.
>
> Something like the following is probably a good indication that it's
> spam:
>
> --8<--
> Dear ux37932,
>
> I've missed talking to you, what is your opinion of <URL>? Please
> check it out and let me know what you think.
> -->8--
>
> If there was any doubt about the paragraph, the "ux37932" makes it
> quite evident to a human that the name in the salutation is not real.
> This is ESPECIALLY true when the name in the salutation is identical,
> byte for byte, including case, as the local part of the email address.
>
>
>