0

i installed smtp4dev to test receive mails in my localserver(xampp) for the registration form here: https://github.com/panique/php-login

note: localserver is on port: 8080

my php.ini file for SMTP section is as follows and the smtp is activated as that was shown in xampp status:

[mail function]
SMTP = localhost
smtp_port = 25
sendmail_from = postmaster@localhost
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
sendmail_path="C:\xampp\mailtodisk\mailtodisk.exe"
;mail.log = "C:\xampp\php\logs\php_mail.log"

but i didn't receive any email, so i checked the smtp if it worked via telnet:

telnet localhost 25

and i get this after running telnet command:

220 localhost smtp4dev ready


Connection to host lost.

how can i solve this problem?

Andrew Schulman
  • 8,561
  • 21
  • 31
  • 47
WhiteOne
  • 3
  • 1
  • 1
  • 3
  • Is the port open and accepting connections? – Proxy Sep 16 '14 at 17:57
  • port 25 status is Time_wait how can i make it listening? i think this the problem right? – WhiteOne Sep 16 '14 at 18:47
  • On Windows you will have to create an firewall rule to explicity allow the port. On Linux you will have to iptables command to add the port to Accept connections. To open a port in issue: iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT – Proxy Sep 16 '14 at 18:50
  • i'm on windows, when i add firewall rule for port 25 do i need to enable it for public also or just private? i will use smtp4dev for my local host only as a test. – WhiteOne Sep 16 '14 at 18:51
  • That depends solely on your network configuration and if you need public access to it. In most cases, you only need to use Private, but you can apply both to see if the problem rectifies and de-select 'public' in the rule at a later stage. Personally, I'd just Private. – Proxy Sep 16 '14 at 18:58
  • okay :) thanks a lot :) that solved my problem when i add a rule for port 25 in firewall settings. – WhiteOne Sep 16 '14 at 19:13

2 Answers2

0

This is reasonable behavior from your mail server. You didn't give it any commands, so it closed the connection.

If you want to talk to the server over telnet, try telling it the following after you connect:

EHLO user

where user is your username, and see if you get a set of status code 250 responses. This guide has other examples of how to talk to an SMTP server by telnet.

Andrew Schulman
  • 8,561
  • 21
  • 31
  • 47
0

As previously discussed in the comments, I am writing this answer for others who may come across this problem.

Adding a Windows Firewall rule to open port 25 will rectify this problem as the connection was rejecting the connection thus not allowing telnet to establish.

Proxy
  • 574
  • 1
  • 4
  • 14