Postfix mail server

Discussion and support for all Linux distributions and Unix flavours (FreeBSD, OpenBSD, etc).
Post Reply
DarkRanger
Registered User
Posts: 8346
Joined: 10 May 2006, 02:00
Processor: Intel i5-3750
Motherboard: Gigabyte
Graphics card: nVidia GTX 550Ti
Memory: 8GB Jetram
Contact:

Postfix mail server

Post by DarkRanger »

Hi guys,

I set up postfix mail server according to a webpage I found because webmin gave a few errors. Anyway, I can access it now using webmin. And now when I send a mail from the intraweb, it queue's the mail, but then doesn't automatically forward. When I try to flush the queue I get this error:

Code: Select all

Forcing the attempted delivery of mail with the command /usr/sbin/postqueue -c /etc/postfix -f ..

postqueue: warning: unable to look up public/qmgr: No such file or directory
postqueue: fatal: Cannot flush mail queue - mail system is down
I've googled the error, but have no luck in finding the solution.

Any ideas?
Image
DarkRanger
Registered User
Posts: 8346
Joined: 10 May 2006, 02:00
Processor: Intel i5-3750
Motherboard: Gigabyte
Graphics card: nVidia GTX 550Ti
Memory: 8GB Jetram
Contact:

Re: Postfix mail server

Post by DarkRanger »

Ok seems I fixed it. It does not make the files go to the queue anymore, so I assume it sends it now. But it doesn't arrive at the recipient. Anyone know where I can see a log or thing to tell me where it sent the mail? Thank you.
Image
DarkRanger
Registered User
Posts: 8346
Joined: 10 May 2006, 02:00
Processor: Intel i5-3750
Motherboard: Gigabyte
Graphics card: nVidia GTX 550Ti
Memory: 8GB Jetram
Contact:

Re: Postfix mail server

Post by DarkRanger »

nevermind. found a log.

Here is why it doesn't deliver:

Code: Select all

Mar 24 10:28:11 web postfix/pickup[1664]: A834D213D0: uid=33 from=<www-data>
Mar 24 10:28:11 web postfix/cleanup[2850]: A834D213D0: message-id=<20100324082811.A834D213D0@mail.3bm.local>
Mar 24 10:28:11 web postfix/qmgr[1665]: A834D213D0: from=<www-data@mail.3bm.local>, size=606, nrcpt=1 (queue active)
Mar 24 10:28:11 web postfix/smtp[2853]: A834D213D0: to=<alberts@3bm.co.za>, relay=none, delay=0.15, delays=0.14/0/0/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=3bm.co.za type=AAAA: Host found but no data record of requested type)
Mar 24 10:28:11 web postfix/cleanup[2850]: D17FF213D1: message-id=<20100324082811.D17FF213D1@mail.3bm.local>
Mar 24 10:28:11 web postfix/bounce[2854]: A834D213D0: sender non-delivery notification: D17FF213D1
Mar 24 10:28:11 web postfix/qmgr[1665]: D17FF213D1: from=<>, size=2546, nrcpt=1 (queue active)
Mar 24 10:28:11 web postfix/qmgr[1665]: A834D213D0: removed
Mar 24 10:28:12 web postfix/local[2855]: D17FF213D1: to=<www-data@mail.3bm.local>, relay=local, delay=0.16, delays=0.07/0/0/0.09, dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION")
Mar 24 10:28:12 web postfix/qmgr[1665]: D17FF213D1: removed
Image
DarkRanger
Registered User
Posts: 8346
Joined: 10 May 2006, 02:00
Processor: Intel i5-3750
Motherboard: Gigabyte
Graphics card: nVidia GTX 550Ti
Memory: 8GB Jetram
Contact:

Re: Postfix mail server

Post by DarkRanger »

Okay, from the above I can see that there is problems regarding the domain it's sending from, so I googled it.

Turns out I had to do some work in the config files. But not even that helped. Maybe someone can point me in the right direction if I post my config file here? Anyhow, here it is:

Code: Select all

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file = /etc/ssl/certs/smtpd.crt
smtpd_tls_key_file = /etc/ssl/private/smtpd.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = mail.3bm.local
mydomain = mail.3bm.co.za
alias_maps = $alias_database
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = 3bmserver.3bm.local, mail.3bm.local, web.3bm.local, localhost.3bm.local, localhost, $myhostname, localhost.$mydomain, localhost, $mydomain
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_protocols = all
smtpd_sasl_local_domain = 
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
smtp_tls_security_level = may
smtpd_tls_security_level = may
smtpd_tls_auth_only = no
smtp_tls_note_starttls_offer = yes
smtpd_tls_CAfile = /etc/ssl/certs/cacert.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
Image
Nuke
Registered User
Posts: 3515
Joined: 28 Feb 2004, 02:00
Processor: Xeon E5620
Motherboard: Asus P6T6 Workstation
Graphics card: MSI GTX770
Memory: 24GB Hynix
Location: ::1

Re: Postfix mail server

Post by Nuke »

First question, do you want to direct deliver to the intended recipient or relay using smtp.saix.net or smtp.isdsl.co.za ?
Image
DarkRanger
Registered User
Posts: 8346
Joined: 10 May 2006, 02:00
Processor: Intel i5-3750
Motherboard: Gigabyte
Graphics card: nVidia GTX 550Ti
Memory: 8GB Jetram
Contact:

Re: Postfix mail server

Post by DarkRanger »

Direct deliver will be best as the mail server and everything is local.

Here is some more help I received on the ubuntu forums.
Image
DarkRanger
Registered User
Posts: 8346
Joined: 10 May 2006, 02:00
Processor: Intel i5-3750
Motherboard: Gigabyte
Graphics card: nVidia GTX 550Ti
Memory: 8GB Jetram
Contact:

Re: Postfix mail server

Post by DarkRanger »

Okay, so I reinstalled ubuntu server with a guide I got off the net. This guide covered everything from setting up LDAP to Postfix. Although neither works yet, it has given me other ways of doing stuff and Postfix doesn't give error anymore. The new name for the server is ubuntu, and the ip now ends in .85, as uposed to web and .215 respectively.

The new postfix config file looks like this:

Code: Select all

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = ubuntu
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = 3bm.co.za, ubuntu, localhost.localdomain, localhost, 3bm.local
relayhost = mail.3bm.local
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = 3bm.local
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_security_options = noanonymous
mydomain = 3bm.local
The problem I am experiencing now though is that it sends mails from the www-data mailbox. When I send a mail using my intraweb form, it says in the log file mail has been delivered. Although it never arrives at the intended recipient. So I went into the mailbox for www-data and found a message stating that the recipient could not be found.

The intended recipient is michaell and this is the message it sends back (for security reasons, I've changed the @-symbol to (at), so it doesn't get picked up by spam bots)
Mail headers View all headers | View raw message
From MAILER-DAEMON(at)3bm.co.za (Mail Delivery System)
To www-data(at)3bm.co.za
Date 29/03/2010 16:37
Subject Undelivered Mail Returned to Sender
Message contents

This is the mail system at host ubuntu.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

The mail system

<michaell(at)3bm.co.za>: unknown user: "michaell"
Any help regarding this?
Image
User avatar
rustypup
Registered User
Posts: 8872
Joined: 13 Dec 2004, 02:00
Location: nullus pixius demonica
Contact:

Re: Postfix mail server

Post by rustypup »

Most people would sooner die than think; in fact, they do so - Bertrand Russel
DarkRanger
Registered User
Posts: 8346
Joined: 10 May 2006, 02:00
Processor: Intel i5-3750
Motherboard: Gigabyte
Graphics card: nVidia GTX 550Ti
Memory: 8GB Jetram
Contact:

Re: Postfix mail server

Post by DarkRanger »

OK, I have no idea how to set that up.

What needs changing in my main.cf file (posted above) to enable delivery to a @3bm.local or @3bm.co.za adress?
Image
DarkRanger
Registered User
Posts: 8346
Joined: 10 May 2006, 02:00
Processor: Intel i5-3750
Motherboard: Gigabyte
Graphics card: nVidia GTX 550Ti
Memory: 8GB Jetram
Contact:

Re: Postfix mail server

Post by DarkRanger »

This is what is shown in the mail.log file.

Code: Select all

Mar 30 13:44:03 localhost postfix/pickup[22720]: D0C3C400FD: uid=33 from=<www-data>
Mar 30 13:44:03 localhost postfix/cleanup[22948]: D0C3C400FD: message-id=<20100330114403.D0C3C400FD@ubuntu.3bm.local>
Mar 30 13:44:03 localhost postfix/qmgr[22721]: D0C3C400FD: from=<www-data@3bm.co.za>, size=616, nrcpt=1 (queue active)
Mar 30 13:44:04 localhost postfix/local[22950]: D0C3C400FD: to=<michaell@3bm.co.za>, relay=local, delay=0.26, delays=0.15/0.01/0/0.1, dsn=5.1.1, status=bounced (unknown user: "michaell")
Mar 30 13:44:04 localhost postfix/cleanup[22948]: 0CD38402DE: message-id=<20100330114404.0CD38402DE@ubuntu.3bm.local>
Mar 30 13:44:04 localhost postfix/bounce[22951]: D0C3C400FD: sender non-delivery notification: 0CD38402DE
Mar 30 13:44:04 localhost postfix/qmgr[22721]: 0CD38402DE: from=<>, size=2335, nrcpt=1 (queue active)
Mar 30 13:44:04 localhost postfix/qmgr[22721]: D0C3C400FD: removed
Mar 30 13:44:04 localhost postfix/local[22950]: 0CD38402DE: to=<www-data@3bm.co.za>, relay=local, delay=0.17, delays=0.08/0/0/0.08, dsn=2.0.0, status=sent (delivered to mailbox)
Mar 30 13:44:04 localhost postfix/qmgr[22721]: 0CD38402DE: removed
Image
DarkRanger
Registered User
Posts: 8346
Joined: 10 May 2006, 02:00
Processor: Intel i5-3750
Motherboard: Gigabyte
Graphics card: nVidia GTX 550Ti
Memory: 8GB Jetram
Contact:

Re: Postfix mail server

Post by DarkRanger »

More help please. If someone could just tell me how to do the bottom 2 things in the post I made on ubuntugeeks, I would greatly appreciate it.

Here is the post.

Thanks.
Image
Post Reply