0

How to set an arbitrary sender and name and address in the From field of every email sent via sendmail, ignoring any sender information already set, replacing original.sender <original.sender@host.tld> by Noreply <noreply@domain.tld> whatever original.sender and host.tld are ?

For context, the mails are sent by a java application using simplejavamail library, which sets variable sender names and addresses which needs to be dismissed. Changing the application is not an option.

I tried several configurations without success :

  • My best try so far is adding the following instructions in sendmail.mc :
    LOCAL_RULE_1
    R $*    $@ noreply <@domain.tld>
    
    Actually, this does not rewrite the whole From field, but only the address part : original.sender@host.tld <noreply@domain.tld>
  • Any other R rule ended in the wanted sender set only in the left side of the address : original.sender@host.tld <Noreply.noreply@domail.tld@host.tld>
  • H commands, like HFrom:noreply@domain.tld, does nothing.
  • HReply-To:noreply@domain.tld actually adds the original sender address in the Reply-To header.
  • I even asked tips to ChatGPT who proposed to use G and S commands alongside R, but I think it is confused with something else as it does not work at all and I did not found any documentation about that.
  • I also tried MASQUERADE feature, but it require a list of masqueraded domains, while I need it to work for any domain. Wildcard seems not to be allowed there.
  • Finally I tried genericstable, but as for MASQUERADE, it seems I can't wildcard domains.

0 Answers0