corecode / dma

The DragonFly Mail Agent, a small Mail Transport Agent (MTA), designed for home and office use.
Other
231 stars 50 forks source link

Replace from header function #112

Open trevor87 opened 2 years ago

trevor87 commented 2 years ago

I had the same problem as described in https://github.com/corecode/dma/issues/75. It has bugged me quite a few times and I saw the work already done by jjakob in https://github.com/corecode/dma/pull/96 and so I thought I'll give it a shot.

I have not coded C for a very long time, so I am not sure if this is the best way to do things. It works fine on my system now and I would be very happy if it could also help others. I'm happy to get feedback and would change the code as needed.

Basically this is the simplest form of fixing the error with cron etc.: If the REPLACEFROM setting is set in the config file (e.g. REPLACEFROM john@gmail.xyzasd) then the header-from will always be replaced with the mail address passed in the config (even if there is no header-from existent at all). The old header-from (e.g. "From: root") is not saved anywhere.

PS: Not sure if I made the changes right in dma.8, never worked with that before.

trevor87 commented 2 years ago

Note: Just noticed that this approach somehow does not work when sending an email via "mail root" when having aliases set up. When sending a mail through "mail john@doe.xyz" it works. I will try to figure out what the problem is there.