cPanel & WHM Version 98 has been released, and brings a slew of great updates. Take a look at what is included, and then upgrade today!

Script that allows cPanel-forwarded emails to pass spam authentication

cPanelKaden shared this idea 5 years ago
Already Exists

One of our customers wrote a script to resolve an issue where resends cause spam filters to mis-identify the email as spam. I'm submitting their script for consideration of being added into a future version of cPanel, per their request:


  1. #!/usr/bin/perl -w
  2. # Author: Steve Wolf (stevewolf6@gmail.com)
  3. # The standard cPanel mail forwarders don't rewrite any of the mail
  4. # headers, which causes SPF tests to fail, of the form:
  5. #
  6. # Received-SPF: softfail (google.com: domain of transitioning
  7. # user@gmail.com does not designate 208.92.162.130 as
  8. # permitted sender) client-ip=208.92.162.130;
  9. # Authentication-Results: mx.google.com;
  10. # dkim=pass header.i=@gmail.com;
  11. # spf=softfail (google.com: domain of transitioning
  12. # user@gmail.com does not designate 208.92.162.130 as
  13. # permitted sender) smtp.mailfrom=user@gmail.com;
  14. # dmarc=pass (p=NONE dis=NONE) header.from=gmail.com
  15. #
  16. # For the most part, these messages get delivered. But we found that
  17. # Apple domains (e.g. me.com, mac.com) consider the authentication to be
  18. # a hard failure from certain addresses (such as paypal.com).
  19. #
  20. # This script inserts Resent-* headers into the message before sending
  21. # it on, thus allowing authentication to succeed downstream.
  22. #
  23. # Call this script with the email addresses to which the message will be
  24. # forwarded, e.g.
  25. #
  26. # "| resend.pl user@example.com user@me.com"
  27. use POSIX qw(strftime);
  28. use Email::MessageID;
  29. my @lines;
  30. while (<STDIN>) {
  31. next if (/^From /);
  32. push(@lines, $_);
  33. }
  34. my $resent_date = strftime("Resent-Date: %a, %d %b %Y %T %z\n",
  35. localtime());
  36. my $resent_id = "Resent-Message-ID: "
  37. . Email::MessageID->new->in_brackets . "\n";
  38. foreach my $to (@ARGV) {
  39. open(MAIL, "| /usr/sbin/sendmail -oi $to")
  40. || die "sendmail failed\n";
  41. print MAIL $resent_date, $resent_id, "Resent-To: $to\n", @lines;
  42. close MAIL;
  43. }

Best Answer
photo

This request is be resolved in cPanel & WHM version 54. You can see it by enabling SRS in the Exim configuration manager in WHM.

Replies (1)

photo
1

This request is be resolved in cPanel & WHM version 54. You can see it by enabling SRS in the Exim configuration manager in WHM.

Replies have been locked on this page!