cannot send mail to localhost with postfix: Temporary lookup failure
20,543
ok, it was a problem with installing postfix. I fixed a config file, removed and re-installed:
root@dur:/etc/postfix#
root@dur:/etc/postfix# diff main.cf main.cf.2
7c7
< #myorigin = /etc/mailname
---
> myorigin = /etc/mailname
40a41,94
>
>
>
> ###adding###
>
>
> # Requirements for the HELO statement
> smtpd_helo_restrictions = permit_mynetworks, warn_if_reject reject_non_fqdn_hostname, reject_invalid_hostname, permit
> # Requirements for the sender details
> smtpd_sender_restrictions = permit_mynetworks, warn_if_reject reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unauth_pipelining, permit
> # Requirements for the connecting server
> smtpd_client_restrictions = reject_rbl_client sbl.spamhaus.org, reject_rbl_client blackholes.easynet.nl, reject_rbl_client dnsbl.njabl.org
> # Requirement for the recipient address
> smtpd_recipient_restrictions = reject_unauth_pipelining, permit_mynetworks, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination, permit smtpd_data_restrictions = reject_unauth_pipelining
>
>
>
>
> # require proper helo at connections
> # smtpd_helo_required = yes
> # waste spammers time before rejecting them
> # smtpd_delay_reject = yes
> # disable_vrfy_command = yes
>
>
>
> # not sure of the difference of the next two
> # but they are needed for local aliasing
> alias_maps = hash:/etc/postfix/aliases
> alias_database = hash:/etc/postfix/aliases
> # this specifies where the virtual mailbox folders will be located
> virtual_mailbox_base = /var/spool/mail/virtual
> # this is for the mailbox location for each user
> virtual_mailbox_maps = mysql:/etc/postfix/mysql_mailbox.cf
> # and this is for aliases virtual_alias_maps = mysql:/etc/postfix/mysql_alias.cf
> # and this is for domain lookups virtual_mailbox_domains = mysql:/etc/postfix/mysql_domains.cf
> # this is how to connect to the domains (all virtual, but the option is there)
> # not used yet
> # transport_maps = mysql:/etc/postfix/mysql_transport.cf
>
>
> virtual_uid_maps = static:5000
> virtual_gid_maps = static:5000
>
>
>
>
>
> # to add if there is not a virtual user
> # sudo mkdir /var/spool/mail/virtual sudo groupadd --system virtual -g 5000
> # sudo useradd --system virtual -u 5000 -g 5000
> # sudo chown -R virtual:virtual /var/spool/mail/virtual
>
> inet_protocols = ipv4
root@dur:/etc/postfix#
root@dur:/etc/postfix# aptitude install -y mysqmail-postfix-logger postfix-mysql mailutils
after which I read my inbox as so:
thufir@dur:~$
thufir@dur:~$ mail
"/var/mail/thufir": 4 messages 4 new
>N 1 hawat@localhost Sat Aug 25 17:04 16/565 hello world
N 2 thufir Sat Aug 25 17:05 13/428 cannot send to localhost
N 3 thufir Sat Aug 25 17:05 15/439 ping
N 4 thufir Sat Aug 25 17:05 15/453 ping
?
X-Original-To: thufir@localhost
To: thufir@localhost
Subject: hello world
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Date: Sat, 25 Aug 2012 17:04:32 -0700 (PDT)
From: hawat@localhost
hello world content yet again
?
X-Original-To: thufir@localhost
To: <thufir@localhost>
Subject: cannot send to localhost
X-Mailer: mail (GNU Mailutils 2.2)
Date: Sat, 25 Aug 2012 21:41:42 +0000 (UTC)
From: thufir@dur (thufir)
ping
?
X-Original-To: thufir@localhost
To: <thufir@localhost>
Cc: <[email protected]>
Subject: ping
X-Mailer: mail (GNU Mailutils 2.2)
Date: Sat, 25 Aug 2012 21:40:51 +0000 (UTC)
From: thufir@dur (thufir)
pong
?
X-Original-To: [email protected]
To: <thufir@localhost>
Cc: <[email protected]>
Subject: ping
X-Mailer: mail (GNU Mailutils 2.2)
Date: Sat, 25 Aug 2012 21:40:51 +0000 (UTC)
From: thufir@dur (thufir)
pong
?
No applicable message
?
No applicable message
? q
Saved 4 messages in /home/thufir/mbox
Held 0 messages in /var/mail/thufir
thufir@dur:~$
which was all that I needed.
Related videos on Youtube
Author by
Alexey Ce
Updated on September 18, 2022Comments
-
Alexey Ce over 1 year
I removed postfix, tried Apache James, removed James, and now cannot get postfix working again:
to my knowledge, I'm using postfix correctly as so:
thufir@dur:~$ thufir@dur:~$ telnet localhost 25 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 dur.bounceme.net ESMTP Postfix (Ubuntu) ehlo test 250-dur.bounceme.net 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN quit 221 2.0.0 Bye Connection closed by foreign host. thufir@dur:~$
Possibly the problem is that sendmail isn't working:
thufir@dur:~$ thufir@dur:~$ postfix sendmail postfix: error: to submit mail, use the Postfix sendmail command postfix: fatal: the postfix command is reserved for the superuser thufir@dur:~$ thufir@dur:~$ sudo postfix sendmail postfix/postfix-script: error: unknown command: 'sendmail' postfix/postfix-script: fatal: usage: postfix start (or stop, reload, abort, flush, check, status, set-permissions, upgrade-configuration) thufir@dur:~$
Telnet gives:
thufir@dur:~$ thufir@dur:~$ telnet localhost 25 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 dur.bounceme.net ESMTP Postfix (Ubuntu) helo localhost 250 dur.bounceme.net mail from:thufir@localhost 250 2.1.0 Ok rcpt to:thufir@localhost 451 4.3.0 <thufir@localhost>: Temporary lookup failure quit 221 2.0.0 Bye Connection closed by foreign host. thufir@dur:~$
which definitely seems intriguing.
-
NlightNFotis over 11 yearsThe logs you have submitted instruct you to use postfix sendmail. Have you tried to do so?
-
Alexey Ce over 11 yearsI am using postfix, at least telnet shows that. Doesn't it?
-
NlightNFotis over 11 yearsYou are indeed using postfix. However the logs you submitted prove the existance of this command: postfix sendmail Have you tried to use it?
-
Alexey Ce over 11 yearsok, I'm maybe using postfix incorrectly. I want to send/receive to user@localhost with postfix. referencing askubuntu.com/a/95974/45156 which I'm going through now. I only need CLI access, though, no squirrel mail or courier, though.
-