0

I have a FreeBSD Server with Postfix and DBmail. The mail system is working perfectly except for one thing: I cannot send an email from domain1.com to domain2.com if they are both hosted on the same server (Or from a website's PHP mailer system to an local hosted mail address). I just want to send an email from a local domain to another local domain.

This is my main.cf file

queue_directory = /var/spool/postfix
command_directory = /usr/local/sbin
daemon_directory = /usr/local/libexec/postfix
data_directory = /var/db/postfix

# Permissions
mail_owner = postfix
default_privs = nobody

# Network
myhostname = hostname.domain.nl
mydomain = domain.nl
myorigin = $mydomain
inet_interfaces = all

# Recipients
virtual_transport = dbmail-lmtp:localhost:24
virtual_mailbox_domains = mysql:/usr/local/etc/postfix/mail_domains.cf
#virtual_mailbox_maps = mysql:$config_directory/sql-virtual_mailbox_maps.cf
unknown_local_recipient_reject_code = 550

# Security
mynetworks = 127.0.0.0/8 [::1]/128 mysql:/usr/local/etc/postfix/sql-pop_before_smtp.cf
#body_checks = regexp:$config_directory/body_checks
#header_checks = regexp:$config_directory/header_checks

# Misc
smtpd_helo_required = yes
strict_rfc821_envelopes = yes
debug_peer_level = 2
debugger_command =
         PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
         ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/local/sbin/sendmail
newaliases_path = /usr/local/bin/newaliases
mailq_path = /usr/local/bin/mailq
setgid_group = maildrop
html_directory = /usr/local/share/doc/postfix
manpage_directory = /usr/local/man
sample_directory = /usr/local/etc/postfix
readme_directory = /usr/local/share/doc/postfix
inet_protocols = ipv4

smtpd_recipient_restrictions = permit_sasl_authenticated permit_mynetworks reject_unauth_destination
smtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks

This error is logged in /var/log/maillog

Mar 14 23:15:06 keroth postfix/smtp[4495]: warning: host mail.domain2.nl[***.***.***.***]:25 greeted me with my own hostname hostname.domain1.nl
Mar 14 23:15:06 keroth postfix/smtp[4495]: warning: host mail.domain2.nl[***.***.***.***]:25 replied to HELO/EHLO with my own hostname hostname.domain1.nl
Mar 14 23:15:06 keroth postfix/smtp[4495]: 821049CC06F: to=<info@domain1.nl>, relay=mail.domain1.nl[***.***.***.***]:25, delay=2.4, delays=0.02/0.01/2.4/0, dsn=5.4.6, status=bounced (mail for domain1.nl loops back to myself)
Mar 14 23:15:06 keroth postfix/smtpd[4497]: disconnect from ***.***.***.***[***.***.***.***]
Mar 14 23:15:06 keroth postfix/cleanup[4493]: DFBDB9CC073: message-id=<20150314221506.DFBDB9CC073@hostname.domain2.nl>
Mar 14 23:15:06 keroth postfix/bounce[4500]: 821049CC06F: sender non-delivery notification: DFBDB9CC073
Mar 14 23:15:06 keroth postfix/qmgr[4479]: DFBDB9CC073: from=<>, size=2145, nrcpt=1 (queue active)
Mar 14 23:15:06 keroth postfix/qmgr[4479]: 821049CC06F: removed
Mar 14 23:15:07 keroth postfix/lmtp[4501]: DFBDB9CC073: to=<www@domain2.nl>, relay=localhost[127.0.0.1]:24, delay=0.12, delays=0/0.01/0/0.11, dsn=5.0.0, status=bounced (host localhost[127.0.0.1] said: 550 Recipient <www@domain2.nl> FAIL (in reply to RCPT TO command))
Mar 14 23:15:07 keroth postfix/qmgr[4479]: DFBDB9CC073: removed
  • You are trying to deliver mail from one postfix instance to an another postfix instance having the same name i.e same myhostname value. In your case it is hostname.domain1.nl – clement Mar 16 '15 at 15:44
  • Hosts can be under same domain, how can two hosts have same name? You can change the myhostname of one postfix server. – clement Mar 19 '15 at 5:30
  • @clement I think you may have misunderstood me. i have one server. if i send an email from info@domain1.com to info@domain2.com (which are hosted on the same server) it doesn't work. – Ruben Urresti Mar 19 '15 at 9:29
  • oh how are you sending the mail? from commandline? Also where are you listing domain1.nl and domain2.nl in postfix? is it under mydestination, or relay_domains or virtual_alias_domains or virtual_mailbox_domains? – clement Mar 19 '15 at 9:44
  • @clement I send the email with commandline OR the PHP mail() function. I am listing the domains in virtual_mailbox_domains – Ruben Urresti Mar 19 '15 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.