This is my first question on Stacks. I always read a lot of solutions to problems here almost every other day. So thank you to all contributors. I am a noob here so please spare some space if I am doing something wrong. My question is
I am trying to setup a Postfix server to be an SMTP only host for multiple domain names. I do not allow remote connection I just want to be able to use my cron scripts to send emails for various domains. Currently Postfix is default installation but I have added
myhostname=example.com
Now problem is if I send email from email@example2.com the host shown in email headers (not in From address) is example.com the exact header is
Received: from example.com
my from address is correct. Pardon me but I really don't know a lot about email servers. My incoming is handled by another hosting provider and I know I need to add a reverse dns etc. So please if anyone knows what I should do so all domains have right DNS entries plus good postfix configuration. I want postfix to use the same domain name as the from address. I only need smtp and nothing else.
I have searched google and Stacks but none answered the question completely even if the question was similar.
Thanks in advance, I am still RTFMing all over the place.
I am also getting these errors in my mailog. i have replaced a real valid domain name with MYDOMAIN and a real system username with USER
Feb 14 22:53:13 li222-89 postfix/smtpd[28433]: connect from localhost[127.0.0.1]
Feb 14 22:53:13 li222-89 postfix/smtpd[28433]: 428FCA400C: client=localhost[127.0.0.1]
Feb 14 22:53:13 li222-89 postfix/cleanup[28436]: 428FCA400C: message-id=<4d59f8a8-0ab4-4aee-b6e6-6f0c9389ad7c@>
Feb 14 22:53:13 li222-89 postfix/qmgr[27293]: 428FCA400C: from=<noreply@MYDOMAIN.net>, size=1047, nrcpt=1 (queue active)
Feb 14 22:53:13 li222-89 postfix/smtpd[28433]: disconnect from localhost[127.0.0.1]
Feb 14 22:53:13 li222-89 postfix/smtp[27755]: certificate verification failed for gmail-smtp-in.l.google.com: num=20:unable to get local issuer certificate
Feb 14 22:53:13 li222-89 postfix/smtp[27755]: certificate verification failed for gmail-smtp-in.l.google.com: num=27:certificate not trusted
Feb 14 22:53:13 li222-89 postfix/pickup[26953]: C3761A400D: uid=500 from=<USER>
Feb 14 22:53:13 li222-89 postfix/cleanup[28436]: C3761A400D: message-id=<20110215035313.C3761A400D@example.net>
Feb 14 22:53:13 li222-89 postfix/qmgr[27293]: C3761A400D: from=<USER@net.net>, size=3237, nrcpt=1 (queue active)
Feb 14 22:53:14 li222-89 postfix/smtp[26830]: certificate verification failed for aspmx.l.google.com: num=20:unable to get local issuer certificate
Feb 14 22:53:14 li222-89 postfix/smtp[26830]: certificate verification failed for aspmx.l.google.com: num=27:certificate not trusted
Feb 14 22:53:15 li222-89 postfix/smtp[27755]: 428FCA400C: to=<somebodysomebody@gmail.com>, relay=gmail-smtp-in.l.google.com[74.125.155.27]:25, delay=2.6, delays=0.02/0.02/0.66/1.9, dsn=2.0.0, status=sent (250 2.0.0 OK 1297741995 l9si6487318yhl.10)
Feb 14 22:53:15 li222-89 postfix/qmgr[27293]: 428FCA400C: removed
Feb 14 22:53:17 li222-89 postfix/smtp[26830]: C3761A400D: to=<USER@net.net>, orig_to=<USER>, relay=aspmx.l.google.com[74.125.155.27]:25, delay=14, delays=11/0/0.44/3.1, dsn=5.1.1, status=bounced (host aspmx.l.google.com[74.125.155.27] said: 550-5.1.1 The email account that you tried to reach does not exist. Please try 550-5.1.1 double-checking the recipient's email address for typos or 550-5.1.1 unnecessary spaces. Learn more at 550 5.1.1 http://mail.google.com/support/bin/answer.py?answer=6596 hj39si8560308ibb.50 (in reply to RCPT TO command))
Feb 14 22:53:17 li222-89 postfix/cleanup[28436]: 726DFA400C: message-id=<20110215035317.726DFA400C@example.net>
Feb 14 22:53:17 li222-89 postfix/qmgr[27293]: 726DFA400C: from=<>, size=5596, nrcpt=1 (queue active)
Feb 14 22:53:17 li222-89 postfix/bounce[28222]: C3761A400D: sender non-delivery notification: 726DFA400C
Feb 14 22:53:17 li222-89 postfix/qmgr[27293]: C3761A400D: removed
Feb 14 22:53:17 li222-89 postfix/smtp[27755]: certificate verification failed for aspmx.l.google.com: num=20:unable to get local issuer certificate
Feb 14 22:53:17 li222-89 postfix/smtp[27755]: certificate verification failed for aspmx.l.google.com: num=27:certificate not trusted
Feb 14 22:53:21 li222-89 postfix/smtp[27755]: 726DFA400C: to=<USER@net.net>, relay=aspmx.l.google.com[74.125.155.27]:25, delay=3.6, delays=0.02/0.01/0.44/3.1, dsn=5.1.1, status=bounced (host aspmx.l.google.com[74.125.155.27] said: 550-5.1.1 The email account that you tried to reach does not exist. Please try 550-5.1.1 double-checking the recipient's email address for typos or 550-5.1.1 unnecessary spaces. Learn more at 550 5.1.1 http://mail.google.com/support/bin/answer.py?answer=6596 mu18si8573893ibb.7 (in reply to RCPT TO command))
Feb 14 22:53:21 li222-89 postfix/qmgr[27293]: 726DFA400C: removed
Obviously its trying to send email to a gmail account but something is wrong …really wrong.
Best Answer
I believe this is what you want.
http://www.postfix.org/ADDRESS_REWRITING_README.html#generic
Example:
So, if you have postfix installed and configured already.
Open main.cf and add the generic maps setting above.
Then open the generic file and add @example.com @example2.com or whatever settings you need for your environment
This is a hash file so when you are done run
postmap /etc/postfix/generic
Then restart postfix.
UPDATE
It looks like this is actually what you are after.
edit the master cf file and change this line
To:
restart postfix
Obviously this will require you to setup multiple IP address, one for each domain and setting up the reverse DNS etc. I believe this is the only way to do this.