Score:0

Postfix doesn't send mail

cn flag

I am trying to learn about mail servers and am quite daunted by all of the moving pieces in the setup..

Currently I am unable to send via from my smtp server. I can receive mails fine from various domains.

In my logs I see the below entries when trying to send mail..

  • mail.log
Jul 31 11:59:15 mail postfix/submission/smtpd[1290]: connect from unknown[78.136.22.232]
Jul 31 12:01:03 mail postfix/postscreen[1294]: CONNECT from [209.85.214.179]:46881 to [45.77.139.149]:25
Jul 31 12:01:03 mail postfix/postscreen[1294]: PASS OLD [209.85.214.179]:46881
Jul 31 12:01:03 mail postfix/smtpd[1297]: connect from mail-pl1-f179.google.com[209.85.214.179]
Jul 31 12:01:05 mail postfix/smtpd[1297]: 03178A46: client=mail-pl1-f179.google.com[209.85.214.179]
Jul 31 12:01:05 mail postfix/cleanup[1299]: 03178A46: message-id=<CAMJ_LmbWv_5o7GZJx8RwqOqz52O_sWTrgX0_=mSi_Vt6+uz++Q@mail.gmail.com>
Jul 31 12:01:05 mail postfix/cleanup[1299]: 03178A46: milter-reject: END-OF-MESSAGE from mail-pl1-f179.google.com[209.85.214.179]: 5.7.1 Gtube pattern; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<mail-pl1-f179.google.com>
Jul 31 12:01:05 mail postfix/smtpd[1297]: disconnect from mail-pl1-f179.google.com[209.85.214.179] ehlo=2 starttls=1 mail=1 rcpt=1 data=0/1 quit=1 commands=6/7
Jul 31 12:04:15 mail postfix/submission/smtpd[1290]: timeout after CONNECT from unknown[78.136.22.232]
Jul 31 12:04:15 mail postfix/submission/smtpd[1290]: disconnect from unknown[78.136.22.232] commands=0/0
root@mail:~#

My OS is Debian 9 and all iptables rules have been flushed while testing this. Here are my master.cf and main.cf --> https://pastebin.com/9WUnzYZt

Thanks

EDIT1: Something I forgot to mention. I did grep 'smtp.*restrict' from my main.cf. I noticed that the smtpd_recipient_restrictions is pointing to a a sql file. The sql file itself has the below query.. Can this be the reason for the outgoing mail to fail?

root@mail:~# grep smtp.*restrict /etc/postfix/main.cf
smtpd_relay_restrictions =      reject_non_fqdn_recipient
smtpd_recipient_restrictions = check_recipient_access mysql:/etc/postfix/sql/recipient-access.cf
smtpd_client_restrictions =     permit_mynetworks
smtpd_helo_restrictions =   permit_mynetworks
smtpd_data_restrictions = reject_unauth_pipelining
root@mail:~# grep query /etc/postfix/sql/recipient-access.cf
query = select if(sendonly = true, 'REJECT', 'OK') AS access from accounts where username = '%u' and domain = '%d' and enabled = true LIMIT 1;
root@mail:~#

EDIT2: I configured mutt to rule out this being a client side issue but still I can't seem to get it working..

└─[$] <> cat muttrc
set folder = "imaps://[email protected]@imap.mydomain.abc:993"
set smtp_url =  "smtp://[email protected]@smtp.mydomain.abc:587"

set from = "[email protected]"
set realname = "hostmaster"

set spoolfile = "+Inbox"
set record = "+Sent"
set trash = "+Trash"
set postponed = "+Drafts"

mailboxes =Inbox =Sent =Trash =Drafts =Junk =Other

however whenever I try to send mail, regardless if it's another domain or the same email address as the sender I see this error

SMTP session failed: 451 4.3.0 <[email protected]>: Temporary lookup failure 
Michael Hampton avatar
cz flag
Your email client connected to the mail server but then just sat there and did nothing for five minutes instead of trying to send out mail. Check your email client settings.
carlitobrigante avatar
cn flag
Hello again Michael and thanks for your help! I shall configure mutt and see if I can send mail from it to rule out this being an issue with my Thunderbird config. I shall update again.
Score:0
cn flag

First issue: I had a typo in my sender-login-maps.cf file. Was saying 'ser' rather than 'user' when specifying the dbuser.

Second issue: After I was able to send mail, I then started the firewall however stopped receiving mail. This was due to incoming connections to tcp 25 being blocked. I didn't allow this as I thought if I've configured smtpd to use 587 it shouldn't need the port 25 open, however that isn't the case for incominng connections.

Mail setup is now working as expected.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.