LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-10-2010, 06:23 AM   #1
Manugal
LQ Newbie
 
Registered: Apr 2010
Posts: 4

Rep: Reputation: 0
Configuring Postfix with external SMTP server


Hi!

I'm trying to configure Postfix with a mail server that I programmed in C. The main.cf is set in this way :

Code:
relayhost = [myMailServer.localhost]
smtp_sasl_auth_enable = no
smtp_use_tls = no
disable_dns_lookups=yes
smtp_never_send_ehlo = yes
The problem arise when I launch mail command. This is what I wrote:
Code:
manugal@manugal-desktop:~$ mail -v -s "Subject" Manugal@myMailServer.localhost
Hello world!
.
EOT
Mail Delivery Status Report will be mailed to <manugal>.
manugal@manugal-desktop:~$
Mail doesn't arrive on my mailbox and if I check mail.log I found this:
Code:
Apr 10 12:11:58 manugal-desktop postfix/master[2756]: daemon started -- version 2.7.0, configuration /etc/postfix
Apr 10 12:12:05 manugal-desktop postfix/pickup[2758]: 5F94C21B28: uid=1000 from=<manugal>
Apr 10 12:12:05 manugal-desktop postfix/cleanup[2763]: 5F94C21B28: message-id=<20100410101205.5F94C21B28@manugal-desktop.localdomain>
Apr 10 12:12:05 manugal-desktop postfix/qmgr[2759]: 5F94C21B28: from=<manugal@manugal-desktop.localdomain>, size=488, nrcpt=1 (queue active)
Apr 10 12:12:05 manugal-desktop postfix/smtp[2765]: < myMailServer.localhost[192.168.1.11]:25: 220 myMailServer.localhost SMTP Service ready
Apr 10 12:12:05 manugal-desktop postfix/smtp[2765]: > myMailServer.localhost[192.168.1.11]:25: HELO manugal-desktop.localdomain
Apr 10 12:12:05 manugal-desktop postfix/smtp[2765]: < myMailServer.localhost[192.168.1.11]:25: 
Apr 10 12:12:58 manugal-desktop postfix/qmgr[2759]: warning: private/smtp socket: malformed response
...
I don't know why it doesn't receive response after HELO. In fact if I debug my mail server with gdb, I can see it sends a 250 response code. Moreover, I've tested my server both with traditional mail clients, as Thunderbird, and through telnet session and it works very well.

Who can help me?
 
Old 04-10-2010, 06:46 PM   #2
blacky_5251
Member
 
Registered: Oct 2004
Location: Adelaide Hills, South Australia
Distribution: RHEL 5&6 CentOS 5, 6 & 7
Posts: 573

Rep: Reputation: 61
Sounds like your SMTP server isn't working properly - I'm assuming Postfix is working OK.

Try using telnet to debug your remote server to see what the problem is. Try
Code:
telnet myMailServer.localhost 25
Then attempt to send an email by entering appropriate data. Use Google to search for EHLO communications, but if you've built your own server, it sounds like you know what the servers send to each other. Using telnet might show you more clearly where it is failing.
 
Old 04-10-2010, 06:50 PM   #3
blacky_5251
Member
 
Registered: Oct 2004
Location: Adelaide Hills, South Australia
Distribution: RHEL 5&6 CentOS 5, 6 & 7
Posts: 573

Rep: Reputation: 61
Sorry, you've tried telnet already.

Can you post the output of "postconf -n", and is your Postfix server able to send email directly (i.e. is it working?).

Should "smtp_never_send_ehlo = yes" be the other way around? Either "smtp_never_send_ehlo = no" or "smtp_always_send_ehlo = yes". My Postfix server uses my ISP to relay outbound email, and I don't use either of these setting (i.e. I use the defaults values which are the opposite to your settings).

Last edited by blacky_5251; 04-10-2010 at 06:52 PM.
 
Old 04-11-2010, 04:10 AM   #4
Manugal
LQ Newbie
 
Registered: Apr 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Hi! I've discovered a strange thing. To do an attempt I've tried to send, as a response, this string "\r\n250 OK\r\n" (so a 250 response code preceded by a CRLF). And now response seems arrive at the other side. Look at mail.log:

Code:
Apr 10 22:05:24 manugal-desktop postfix/smtp[2849]: 84A4821BDA: to=<Manugal@myMailServer.localhost>, relay=none, delay=0.02, delays=0.02/0/0/0, dsn=4.4.1, status=deferred (connect to myMailServer.localhost[192.168.1.11]:25: Connection refused)
Apr 10 22:05:36 manugal-desktop postfix/pickup[2846]: 70F9E21BDD: uid=1000 from=<manugal>
Apr 10 22:05:36 manugal-desktop postfix/cleanup[2859]: 70F9E21BDD: message-id=<20100410200536.70F9E21BDD@manugal-desktop.localdomain>
Apr 10 22:05:36 manugal-desktop postfix/qmgr[2847]: 70F9E21BDD: from=<manugal@manugal-desktop.localdomain>, size=488, nrcpt=1 (queue active)
Apr 10 22:05:40 manugal-desktop postfix/smtp[2850]: < myMailServer.localhost[192.168.1.11]:25: 220 myMailServer.localhost SMTP Service ready
Apr 10 22:05:40 manugal-desktop postfix/smtp[2850]: > myMailServer.localhost[192.168.1.11]:25: HELO manugal-desktop.localdomain
Apr 10 22:05:46 manugal-desktop postfix/smtp[2850]: < myMailServer.localhost[192.168.1.11]:25: 
Apr 10 22:05:46 manugal-desktop postfix/smtp[2850]: < myMailServer.localhost[192.168.1.11]:25: 250 OK
Apr 10 22:05:46 manugal-desktop postfix/smtp[2850]: server features: 0x1000 size 0
Apr 10 22:05:46 manugal-desktop postfix/smtp[2850]: > myMailServer.localhost[192.168.1.11]:25: MAIL FROM:<manugal@manugal-desktop.localdomain>
...
I don't know why replies must be sent in this way. Something is wrong.

However, in reply to you, I've used smtp_never_send_ehlo only for test, because I thought it was the reason of my problem. Moreover, my mail server is RFC821-compliant, so if I send a 502 response code to Postfix, it sends me HELO in place of EHLO, right?

Last edited by Manugal; 04-11-2010 at 04:17 AM.
 
Old 04-11-2010, 05:17 AM   #5
blacky_5251
Member
 
Registered: Oct 2004
Location: Adelaide Hills, South Australia
Distribution: RHEL 5&6 CentOS 5, 6 & 7
Posts: 573

Rep: Reputation: 61
I'm curious as to why your log shows "relay=none" on the first line of the log, when it should say "relay=myMailServer.localhost[ip.address.x.x]:25". Is it valid syntax to put the name of the relay server inside square brackets? My main.cf just has "relayhost = hostname.domain.com".
 
Old 04-11-2010, 05:35 AM   #6
Manugal
LQ Newbie
 
Registered: Apr 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Yes it's valid. From Postfix documentation:

"The form enclosed with [] eliminates DNS MX lookups"

I don't use DNS, but I've modified /etc/hosts to communicate with myMailServer.localhost.

I don't know why it says relay=none but the communication works anyway.

However, deleting square brackets doesn't resolve the problem.
 
Old 04-11-2010, 05:40 AM   #7
Manugal
LQ Newbie
 
Registered: Apr 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Perhaps that line, where there's relay=none, is a line from a previous try that I made. In fact smtp process ID in that line is different, as you can see. Ignore that.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SMTP Server With PostFix ManuMayer Linux - Newbie 5 05-15-2010 10:04 AM
SMTP authentication error and server could not connected in postfix server Ravinder Singh Thakur Linux - Server 1 11-02-2009 10:22 AM
Postfix SMTP Server wprophet Linux - Server 1 12-09-2008 05:22 AM
Postfix - howto use smtp auth for external client but not for localhost rahmmandel Linux - Server 14 03-18-2007 10:45 PM
cannot telnet postfix smtp 25 on external ip slam Linux - Software 4 04-20-2006 03:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration