Postfix not able to send mail

Me, a great newbie, need help with Postfix.

I'm running Debian and I've installed postfix and postfix-mysql to do some alias work. I've created the corresponding tables and put the virtual-… lines in my main.cf file. I've used in good part the following howto: http://high5.net/howto/.

Now, the postfix server is running and my firewall is open to SMTP. When I do the following:

telnet mymailserver.domain.org 25
Trying xx.xx.xx.xx...
Connected to mymailserver.domain.org.
Escape character is '^]'.
220 mymailserver.domain.org ESMTP Postfix (Debian/GNU)
helo mydomain.com
250 mymailserver.domain.org
mail from: <>
250 Ok
rcpt to: <whatever@domain.org></whatever@domain.org>

And it stops here: no confirmation, no error message, no timeout (yet). Same thing if I put an address in the 'mail from' field. It works when I specify no email address, it tells me to write a valid email address if I input a wrong one but if the address is valid, it seems like it tries to compare it to something and it freezes there.

I guess it's something stupid I'm missing as I'm a mail server newbie but my searches in Google haven't returned anything helpful yet.

Does it ring a bell for anyone out there?

Thanks! :)

9 Replies

Also, the 'mail' program does not send mail, whatever the address is, locally or externally.

If there is nothing useful in the mail error log, try turning on verbose logging - add the parameter -v to the line in master.cf that invokes the smtp service of type inet and then restart postfix.

As previous poster said, check your /var/log/mail.log and I'd also look at /var/log/mysql/ I suspect the DB lookup is failing for some reason. There are numerous possibilities, judging by the guide you followed, my first guess (this is what caught me out) would be that postfix is running chrooted (which it generally does), so it can't access MySQL via the file socket - you'll probably need to contact it via the network socket.

This means first checking mysql is set up to listen on a network socket, (beware of the security issues with this) and then editing the 4 mysql…cf files you created so hostname is a hostname associated with your IP address in /etc/hosts and not localhost.

In my mail.err I now have:

fatal: mysql:/etc/postfix/mysql_virtual_alias_maps.cf(0,100): table lookup problem

Numerous times. Also, in mail.log:

 postfix/trivial-rewrite[2845]: warning: connect to mysql server localhost: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
 postfix/trivial-rewrite[2845]: fatal: mysql:/etc/posfix/mysql_virtual_alias_maps.cf(0,100): table lookup problem

Seems you two are right. But what's best? Not to run the daemon chrooted or to open the socket in the firewall?

Ok, I've made the trivial-rewrite not run chrooted and now I can go a little further.

Trying xx.xx.xx.xx...
Connected to mymailserver.domain.org.
Escape character is '^]'.
220 mymailserver.domain.org ESMTP Postfix (Debian/GNU)
helo test.com
250 mymailserver.domain.org
mail from: <test@test.com>250 Ok
rcpt to: <you@otherdomain.com>554 <you@otherdomain.com>: Relay access denied
rcpt to: <me@mymailserver.domain.org>451 <me@mymailserver.domain.org>: Temporary lookup failure</me@mymailserver.domain.org></me@mymailserver.domain.org></you@otherdomain.com></you@otherdomain.com></test@test.com> 

I'm still working on it but if you have any ideas, they're welcome!

Why the 451 error?

Now I've made run not-chrooted the

smtp

pickup

cleanup

rewrite

And it seems I can send mail. Great!

  • Now, is there any security risks associated with unchrooting the previous service?

  • Also, it seems to reject mail from unknown domain. Is it a little bit to restrictive? I know it is good not to relay mail to unknown domain but from unknown domain, what if the domain is new?

Thank you for your help! :P

I didn't want to setup a 127.0.0.1 socket for mysql (although that's a fairly reasonable solution, and I didn't want to run postfix outside a chroot(), and eventually this popped into my head:

mkdir /var/spool/postfix/var/run/mysqld

mount -o bind /var/run/mysqld /var/spool/postfix/var/run/mysqld

Bind mounts allow you to make a directory tree show up somewhere else. Nifty, eh? If you go this route, don't forget to add a entry in

/etc/fstab, so it last over a reboot:

/var/run/mysqld /var/spool/postfix/var/run/mysqld auto bind 0 0

(the above paths are for Debian, don't know what RH et. al. do with mysql socket paths.)

Very nifty!

Works great with Debian, thanks!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct