Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
04-10-2010, 07:23 AM
|
#1
|
LQ Newbie
Registered: Apr 2010
Posts: 4
Rep:
|
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?
|
|
|
04-10-2010, 07:46 PM
|
#2
|
Member
Registered: Oct 2004
Location: Adelaide Hills, South Australia
Distribution: RHEL 5&6 CentOS 5, 6 & 7
Posts: 573
Rep:
|
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.
|
|
|
04-10-2010, 07:50 PM
|
#3
|
Member
Registered: Oct 2004
Location: Adelaide Hills, South Australia
Distribution: RHEL 5&6 CentOS 5, 6 & 7
Posts: 573
Rep:
|
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 07:52 PM.
|
|
|
04-11-2010, 05:10 AM
|
#4
|
LQ Newbie
Registered: Apr 2010
Posts: 4
Original Poster
Rep:
|
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 05:17 AM.
|
|
|
04-11-2010, 06:17 AM
|
#5
|
Member
Registered: Oct 2004
Location: Adelaide Hills, South Australia
Distribution: RHEL 5&6 CentOS 5, 6 & 7
Posts: 573
Rep:
|
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".
|
|
|
04-11-2010, 06:35 AM
|
#6
|
LQ Newbie
Registered: Apr 2010
Posts: 4
Original Poster
Rep:
|
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.
|
|
|
04-11-2010, 06:40 AM
|
#7
|
LQ Newbie
Registered: Apr 2010
Posts: 4
Original Poster
Rep:
|
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.
|
|
|
All times are GMT -5. The time now is 07:49 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|