Viktor Dukhovni: > On Tue, Sep 27, 2022 at 03:31:52PM +0800, Ken Peng wrote: > > > juan smitt wrote: > > > postmaster postmas...@example.com # this is a comment > > > > I have tested that, the section after # will cause no problem. > > Your tests were flawed or were testing something else entirely. As > Wietse noted, end-of-line comments are NOT ignored by Postfix except > when the entire preceding string is ignored. > > Only full line comments are supported: > > virtual: > # This is a comment > postmaster postmas...@example.com > luser lu...@example.com # this is not what you want
If you are certain that # will not appear inside an email address, you can main a source file with comments, and use use automation to strip the comments when creating the indexed file. Below is a variation on the text in https://www.postfix.org/DATABASE_README.html#safe_db # cat Makefile all: aliases.db access.db virtual.db ...etcetera... ... skipping a few examples... virtual.db: virtual.src sed 's/#.*//' virtual.src > virtual.in postmap virtual.in mv virtual.in.db virtual.db ...etcetera... Then, you edit the virtual.src file: # vi virtual.src ...editing session not shown... And execute the "make" command to update the table. # make sed 's/#.*//' virtual.src > virtual.in postmap virtual.in mv access.in.db access.db #