Basic postfix configuration

Hi, please can you provide me with a basic configuration master.cf and main.cf file for postfix, which does work, because I have very hard time setting up the mailserver up.

I have read all of the manuals that I have found how to setup postfix with virtualmin, but none of my tries have worked and the postfix gives me all kind of different errors. So, any kind of help regarding the mail server configuration will be much apreciated :).

Thanks in advance.

Currently, I have managed to setup postfix to send emails to another emails like gmail, but when I try to send an email to the server I get the following error

mail for myhost.mydomain.com loops back to myself)

Here is my current postfix configuration

canonical_maps = hash:/usr/local/etc/postfix/canonical
command_directory = /usr/local/sbin
config_directory = /usr/local/etc/postfix
daemon_directory = /usr/local/libexec/postfix
debug_peer_level = 2
html_directory = no
local_recipient_maps = unix:passwd.byname $alias_maps
mailq_path = /usr/local/bin/mailq
manpage_directory = /usr/local/man
mynetworks_style = host
newaliases_path = /usr/local/bin/newaliases
readme_directory = no
recipient_canonical_maps = hash:/usr/local/etc/postfix/recipient_canonical_maps
sample_directory = /usr/local/etc/postfix
sender_canonical_maps = hash:/usr/local/etc/postfix/sender_canonical_maps
sendmail_path = /usr/local/sbin/sendmail
setgid_group = maildrop
smtpd_recipient_restrictions = permit_mynetworks reject_unauth_destination
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/usr/local/etc/postfix/virtual

I really appreciate any kind of help regarding this issue.

Here is the current error that I get

70809B829: from=<n.serev@gmail.com>, size=2017, nrcpt=1 (queue active)
Jan 28 14:27:39 smartcom postfix/smtp[21412]: 70809B829: to=<ven@smartcom.my2bytes.com>, orig_to=<ven@venditamr.com>, relay=none, delay=0.99, delays=0.5/0/0.49/0, dsn=5.4.6, status=bounced (mail for smartcom.my2bytes.com loops back to myself)

I am sure that it is something simple, but since now I was not able to find what could cause the issue. Does anyone have any idea ?

it seems that postfix don’t know that email you are sending is dedicated to it. Is the domain mydomain.myshotname.com listed in any of *maps ?

and do you have directives

mynetworks = 127.0.0.1
myhostname = mybox.mydomain.org
mydomain = mydomain.org
myorigin = $myhostname

in main.cf?

I’ll try to help you out if this won’t work

Hi rawwww,

Thanks for the reply, my machine is named host.mydomain.com and the MX record for my domain is pointed to

mydomain2.com. 74942 IN MX 10 host.mydomain.com.

Also host.mydomain.com is not listed in the virtual files, but I have added it in my main.cf file. Here is my current configuration file.

allow_percent_hack = no
append_at_myorigin = no
append_dot_mydomain = no
canonical_maps = hash:/usr/local/etc/postfix/canonical
command_directory = /usr/local/sbin
config_directory = /usr/local/etc/postfix
daemon_directory = /usr/local/libexec/postfix
home_mailbox = Maildir/
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
mydestination = mydomain.com, host.mydomain.com, mydomain2.com
mydomain = mydomain.com
myhostname = host.mydomain.com
mynetworks = 127.0.0.1
myorigin = $myhostname
newaliases_path = /usr/bin/newaliases
readme_directory = /usr/share/doc/postfix-2.4.5/readme
recipient_canonical_maps = hash:/usr/local/etc/postfix/recipient_canonical_maps
sample_directory = /usr/local/etc/postfix
sender_canonical_maps = hash:/usr/local/etc/postfix/sender_canonical_maps
sendmail_path = /usr/sbin/sendmail
setgid_group = maildrop
smtpd_delay_reject = no
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
unknown_local_recipient_reject_code = 550
virtual_alias_domains = $virtual_alias_maps
virtual_alias_maps = hash:/usr/local/etc/postfix/virtual

Like I said I am able to send emails to any other mail server from this machine, but I am not able to receive any messages.

Cheers,
Maznislav

I assume that you’ve read this article
http://www.postfix.org/VIRTUAL_README.html
section
Postfix virtual ALIAS example: separate domains, UNIX system accounts
and you have listed mydomain.com in virtual file and during to README
you have this done correctly (it seems that you don’t)
NEVER list a virtual alias domain name as a mydestination domain!
If this won’t help please tell me more.

Thanks for the help mate, I have read this article and I believe that my configuration is set correctly. I think that the issue is caused from my DNS settings. Currently the domain mydomain2.com has the following MX zone

mydomain2.com. 86400 IN MX 20 mail.mydomain.com.
mydomain2.com. 86400 IN MX 10 myhost.mydomain.com.

And myhost is set to be the hostname to my server and the mail is set as a CNAME of myhost. Is this correct or should I change my DNS settings to something else ?

I just want to thank for the help, I have figured out what was the issue and now everything does work fine. The line that I have added in the main.cf file, which have resolved my issue is

local_recipient_maps = proxy:unix:passwd.byname $alias_maps

Now I am able to send and receive emails with no probs :). Special thanks to rawww, which have helped me a lot.