Need Help With Issues Using Postfix Generic Rewrite

I have been following along with this Wiki: Sangoma Documentation to send messages out into the real world. I still can’t get it to rewrite the FROM address. In my Postfix generic file I have different variations:

root [email protected]
root@localhost [email protected]
[email protected] [email protected]
root@freepbx [email protected]
[email protected] [email protected]
asterisk [email protected]
asterisk@localhost [email protected]
[email protected] [email protected]
asterisk@freepbx [email protected]
[email protected] [email protected]
[email protected] [email protected]
vm@asterisk [email protected]
[email protected] [email protected]

After editing generic, I run postmap /etc/postfix/generic and restart Postfix. After sending a test email from the CL using mail from the asterisk user, maillog indicates a failure and that the FROM address is: [email protected]. I also have smtp_generic_maps = hash:/etc/postfix/generic at the end of my main.cf file.

If I edit generic to only have the line:

@freepbx.localdomain @realdomain.com

…then I can see in maillog that the FROM address is: [email protected]. This fails also since I don’t have an outside email account named “asterisk”, but indicates to me that the generic rewriting is working somewhat. I also have the same problem emailing incoming faxes even though I have the fax address rewrite in the generic file.

What the heck am I missing?

Are you escaping the @ signs? Seems to me PostFix is particular about that sometimes.

I am not. I will try it. Although I don’t remember seeing anything about it on Postfix online docs, either.

There are two places where not escaping the @ can mess with you. I think PostFix is usually pretty good about it, but remember that we are running all of this through a system written in PHP, which is horrific when it comes to working with @ signs.

I tried to escape the @ symbol, but no change in testing. The initial testing is from the command line using mail. And, to retest (with and without escaping the @ symbol, only having “@freepbx.localdomain @realdomain.com” in the generic file and postfix attempts to rewrite it using the proper domain name: [email protected] becomes [email protected] and [email protected] becomes [email protected]

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.