Score:0

How to rewrite completly the sender of all outbound mail in sendmail?

de flag

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 <[email protected]> by Noreply <[email protected]> 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 : [email protected] <[email protected]>
  • Any other R rule ended in the wanted sender set only in the left side of the address : [email protected] <[email protected]@host.tld>
  • H commands, like HFrom:[email protected], does nothing.
  • HReply-To:[email protected] 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.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.