Postfix is sending email from root to from email address

hi

I have configures postfix in freepbx for voicemail notifications and other notifications like fail2ban and worked fine but now when I test sending email it is sending the email to the email address which is configured to send email to other email addresses.

please need help on this as this is getting worse and my from email address is receiving all the emails instead of sending to destination email addresses.

Are you running the FreePBX Distro (did you install from their iso)?
Did you make any changes to the postfix configuration?

yeah I am running FreePBX distro and install it from ISO, I configure it according to my mail server and it was sending mails perfectly fine but now I don’t know what happened mails are not delivering.

Please check logs of /var/log/maillog

Jan 9 10:25:02 voip postfix/pickup[61344]: 78A541041AE: uid=499 from=
Jan 9 10:25:02 voip postfix/cleanup[64486]: 78A541041AE: message-id=[email protected]
Jan 9 10:25:02 voip postfix/qmgr[51719]: 78A541041AE: from=[email protected], size=1345, nrcpt=1 (queue active)
Jan 9 10:25:06 voip postfix/smtp[64490]: 78A541041AE: to=[email protected], orig_to=, relay=secure.emailsrvr.com[X.X.X.X]:587, delay=3.9, delays=0.36/0.01/2.2/1.3, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 4A1D95543)
Jan 9 10:25:06 voip postfix/qmgr[51719]: 78A541041AE: removed
Jan 9 10:30:02 voip postfix/pickup[61344]: 31D011041AB: uid=499 from=
Jan 9 10:30:02 voip postfix/cleanup[64979]: 31D011041AB: message-id=[email protected]
Jan 9 10:30:02 voip postfix/qmgr[51719]: 31D011041AB: from=[email protected], size=1345, nrcpt=1 (queue active)
Jan 9 10:30:05 voip postfix/smtp[64985]: 31D011041AB: to=[email protected], orig_to=, relay=secure.emailsrvr.com[173.203.187.10]:587, delay=3.8, delays=0.27/0.01/2.1/1.3, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as E831C25501)
Jan 9 10:30:05 voip postfix/qmgr[51719]: 31D011041AB: removed

now what is happening whenever I send mail to any email id, the mails send to [email protected], but it is not relaying the mail to that mail id or destination mail id.

What changes did you make to configure postfix? Did you add lines to /etc/postfix/main.cf ?

here are the changes which were setup in main.cf

mydestination = $myhostname, localhost.$mydomain, localhost
myorigin = example.com
relayhost = secure.emailsrvr.com:587
smtp_generic_maps = hash:/etc/postfix/generic
smtp_sasl_auth_enable = yes
smtp_sasl_mechanism_filter = AUTH LOGIN
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =

and in sasl_password i have associated the email address with password:

secure.emailsrvr.com:587 [email protected]:password

these are the settings and with these settings mails were delivering fine but I don’t know what happened now that they are not being delivered as you can see in the logs as well.

Hi!

What we see in the logs is that they are being relayed to secure.emailsrvr.com…

Sounds to me like the problem is elsewhere (ie they might be detected as spam by the server secure.emailsrvr.com later relays to…

You obviously obfuscated things (I seriously hope that you are not using example.com for real, if I am not mistaken its SPF record would get your emails blocked…) but your message ID (voip.development.server) suggest that you are using phony informations for your domain name so it’s quite possible your emails get blocked (or put in a spam folder) along the way…

Good luck, have a nice day and Happy New Year!

Nick

yeah example.com is just for confidential purpose, not to disclose the domain here.

look [email protected] is the email id created at the domain and it is set in /etc/postfix/generic
file.
i.e : @example.com [email protected]

now when I am sending test mail also to other email addresses, the postfix send it to [email protected] instead of sending it to that email id. and all the emails of each mailbox or voicemail user is sent to [email protected].

hope you understand now what is happening.

I had never played with smtp_generic_maps and god knows I played a lot with Postfix quite a few years ago so I had to read up on it…

re: http://www.postfix.org/postconf.5.html#smtp_generic_maps

@example.com [email protected]

is a catch all… Everything under the domain example.com (or your real domain) gets rewritten into [email protected]…

The other email adddresses you want to send mails to are they also under the same domain? If they are then they will also get rewritten into [email protected].

Good luck and have a nice day!

Nick

yes they are on the same domain.

well now I test with gmail and it is sending to gmail perfectly fine but not sending into my own domain.

Jan 9 13:32:15 localhost postfix/pickup[26890]: A497D5636DE: uid=0 from=
Jan 9 13:32:15 localhost postfix/cleanup[29750]: A497D5636DE: message-id=[email protected]
Jan 9 13:32:15 localhost postfix/qmgr[30513]: A497D5636DE: from=[email protected], size=439, nrcpt=1 (queue active)
Jan 9 13:32:18 localhost postfix/smtp[29752]: A497D5636DE: to=[email protected], relay=secure.emailsrvr.com[X.X.X.X]:587, delay=2.8, delays=0.12/0.01/1.6/1.1, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 465DFA00BA)
Jan 9 13:32:18 localhost postfix/qmgr[30513]: A497D5636DE: removed

So you have email addresses like

[email protected]
[email protected]
[email protected]
[email protected]
[email protected] ?

with your

@example.com [email protected]

These will all get delivered to [email protected] because this is what you asked by putting this line…

Am I understand this right?

Nick

yeah actually this is what happening with local domain all the emails to [email protected] is sent to [email protected].

what is happening is that it is replacing the to and from email addresses to [email protected] and send it to [email protected] email id.

but when I use gmail address it send the email correctly and I received the email from [email protected]

Hi!

This is normal as it is not rewritten by

@example.com [email protected]

of your smtp_generic_map…

What exactly do you want to do and why do you need to rewrite those addresses to begin with?

Are you using a real domain or a phony one?

Good luck and have a nice day!

Nick

Also, do you have System Admin Pro or is this why you are trying to rewrite fhose addresses?

ok let me clear you the scenario.

I have pbx domain in local environment with private IPs network and one external IP but it is not open for internet domain, it is only setup for local access. however we have our own email domain setup at rackspace publically accessible via internet.
I have configured extensions with the voicemail ids of my email domain.

can you please tell me now how to setup this.
however This was working perfectly fine with these settings but now I don’t know what happened and i am getting issue.

no I have only system admin not pro.

Why are you rewriting those addresses?

Is it only to deal with the root sender email address?

If it is, why don’t you put

[email protected] [email protected]

in that generic table?

Followed, obviously since it is a hash table by

postmap hash:/etc/postfix/generic

Why did you set up that rewriting in the first place?

Good luck and have a nice day!

Nick

I didn’t put [email protected] but I put [email protected]

and yes i want to rewrite the sender addresses. so that when any one get the voicemail notification the email id of sender will be of our domain.

I know but that’s not what I meant… Dealing with those phony email address is a pain… I am not exactly sure what you actually wrote in there…

Let’s say your local domain is domain.local and that you would like to rewrite the sender to your real domain, example.com…

Let’s say the sender is [email protected] and that you want to rewrite it to [email protected]

You would add this line to your generic table:

[email protected] [email protected]

Now you tell me that you put

@example.com [email protected]

is “example.com” in @example.com the phony domain name of your FreePBX box or your real domain?

It sounds like it’s your real domain name which is why everything probably gets forwarded to [email protected].

You don’t want to rewrite YOURREALDOMAIN into [email protected], only the phony email addresses of your FreePBX box needs to be rewritten…

Like I said I am not exactly sure what you wrote because you replaced everything with example.com…

As to why it worked before, depending on what you did it could be everything from new anti-spam measure, the addition of a SPF record on your domain or someone simply running postmap on that generic table and it had not been done before with that configuration…

Good luck and have a nice day!

Nick

I test sending mail using this command
mail [email protected]

Jan 9 16:05:35 voip postfix/pickup[26856]: CF265104205: uid=0 from=
Jan 9 16:05:35 voip postfix/cleanup[34373]: CF265104205: message-id=[email protected]
Jan 9 16:05:35 voip postfix/qmgr[26857]: CF265104205: from=[email protected], size=449, nrcpt=1 (queue active)
Jan 9 16:05:38 voip postfix/smtp[34381]: CF265104205: to=[email protected], relay=secure.emailsrvr.com[173.203.187.10]:587, delay=2.8, delays=0.21/0/1.6/0.97, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as EB4F025C47)
Jan 9 16:05:38 voip postfix/qmgr[26857]: CF265104205: removed