I have a problem for a couple of days ago me going crazy, I have a script that sends mails using phpMailer and arsys.
The fact is that the overnight stops working, check the code and seems fine, it's more, it works correctly if I run it from the test server that comes through another IP.
I found that the server was not on any spam blackList and found the reference to be to a PBL, me worry about removing it from there.
Anyway, I still can not send mail from that server and both my other test script I programmed work correctly on development server but not on the production server.
The error that is specifically this
SMTP -> ERROR: EHLO not accepted from server:
SMTP -> ERROR: HELO not accepted from server: 220 ESMTP Postfix smtp-04.servidoresdns.net
SMTP -> ERROR: AUTH not accepted from server: 250-250-llsg993-a04.servidoresdns.net PIPELINING 250-SIZE 51200000 250-ETRN 250-250-STARTTLS AUTH DIGEST-MD5 CRAM-MD5 LOGIN PLAIN 250-AUTH = DIGEST MD5 CRAM-MD5 LOGIN PLAIN 250-250 8BITMIME ENHANCEDSTATUSCODES
It says it can not authenticate the credentials are fine but since the same script from another server goes perfectly.
Also came through a tcptraceroute to port 25 SMTP server.
Only strange thing I see is that when running
tcptraceroute p 25 smtp.miservidor.com
He says:
Sorry, Local Requested port is already in use. Use P, instead of p, to override.
But after using P instead of p and functions
Anyone shed me some light on this?
Who may be filtering my IP address ??
It's very common for ISPs to block outbound connections to port 25 by default. Try using SMTPSecure = 'tls' and Port = 587 - that server definitely responds on that port.
Connection problems are covered in the PHPMailer docs.
I noticed that never answered this question, the problem was the time, the function did not have enough time to contact with server. I increased the time in phpMailer class and everything went back to work.
Related
Recently I've been experimenting with a simple script that listens on port 25, and receives and logs any incoming emails.
It's a very primitive script, and it doesn't implement the SMTP protocol at all. It just simply spits out canned replies, and it works something like this:
Wait for an incoming socket.
Send "220 example.com ESMTP Postfix".
Receive one line, typically like "EHLO other.com".
Send "250 example.com, I am pleased to meet you".
Receive lines until "DATA", reply with "250 Ok" every time".
Send "354 End data with .".
Receive lines until "." is received.
Send 250 Ok: queued as 12345.
Receive any final lines then close the socket.
(example.com is in place of my real domain's FQDN.)
It's a very crude script indeed; however, for the past few months it's worked perfectly for every email that I needed to receive. I can receive fine from Gmail, Protonmail, verification emails, etc. I also caught some internet-wide scans, so it serves as a fun honeypot too.
Today, I tried to receive a Microsoft account verification email to register a Microsoft account. The remote client didn't seem to respond to the 220 at all!
# nc -l -v -p 25
Listening on [0.0.0.0] (family 0, port 25)
Connection from mail-co1nam03on0003.outbound.protection.outlook.com 56725 received!
220 example.com ESMTP Postfix
No matter what I tried, the client wouldn't send anything. What am I doing wrong? Any ideas are welcome.
tripleee solved this in the comments, so I'm posting it as an answer here for everyone to see. The problem is that I was giving just LF as a newline, not CRLF. So I replaced all the '\n' with '\r\n' in my code, and that fixed it. I guess the other mailservers were just being lenient with me.
For years I used port 465 for my outgoing email with no problem, but suddenly my desktop client (eM Client) refused to send messages. I went to my provider for advice and they claim they haven't changed any settings and it's my client's fault. Hmm... I've changed the port to 587 and it works smoothly now.
But I've noticed that my mobile client (AirMail on iOS) still uses port 465! What's more, when I tried updating it to 587, it stopped working and I had to revert to 465.
So now I have working mail on desktop on port 587 and on mobile on port 465, all with the same provider! It's no real issue, but I can help wondering: what's the real reason for it? Can it be actually attributed to the client software I use?
It would be much easier to provide useful answers if you could provide more details, such as what error responses your clients got from the server when they tried to send email, and what you tried to do to fix the problem.
This is a bit of a wild guess: maybe your desktop is no longer able to send email over a secure (TLS) connection on port 465, but it can send email over an insecure connection on port 587. That might indicate a problem with a certificate.
Indeed! Here's the error message I was getting:
[CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT IDLE CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS ACL RIGHTS=texk QUOTA STARTTLS AUTH=PLAIN AUTH = LOGIN] Dovecot ready.'.
I may be wrong as I have no access to my desktop at the moment but I believe that sending over 587 happens with SSL, at least that's the security set in the account configuration.
I've been looking for an answer to this all over the internet, and sadly I've come nowhere near one.
Today I decided to write a SMTP server for sending/recieving emails from my RPi. I wanted to do it from scratch, so switching to Postfix is not an option. I've wrote my code on Java and all the connections are handled with sockets.
My server works like -as I understood- most SMTP servers work:
- Email sender connets to my server on port 25.
- I say "220 Hello, welcome to my server"
- They then reply HELO or EHLO and so the communication goes on.
This has worked great so far with GMail, some anonymous email sending websites, mail.com, etc, but I can't make it work with Hotmail and Yahoo. They connect, I send them the "220 Hello, etc" line, but they don't reply HELO nor EHLO nor anything at all.
Yahoo has been trying to connect for a while now, but they don't reply anything at all. Neither does, again, Hotmail.
Do you know if they work in some special way, if I am messing something up with the protocol, or what could be happening?
Thank you very much.
EDIT
Some other things:
- I'm using a No-ip address.
- I'm listening to ports 25, 465 and 587, and all of them have been opened in my router.
Make sure your lines end with \r\n and not just \n.
I configured exim mail server on centos. It is working with no encryption type. But not with SSL and TLS. I din't get correct solution for this type of error. Can anyone tell solution and why this error message in exim main.log file?
The error message is like below in the exim main.log file.
2015-03-17 10:34:16 SMTP protocol synchronization error (input sent without waiting for greeting): rejected connection from H=acp-node [10.7.2.137] input="\026\003\001"
(input sent without waiting for greeting) ... input="\026\003\001"
In short: You are trying to use implicit TLS on a port where explicit TLS is needed.
In detail: There are two ways to use TLS with SMTP:
implicit TLS, that is TLS from start. This is used on port 465 (smtps). This mode is in some SMTP stacks simply called "SSL".
explicit TLS, that is start with plain SMTP and upgrade to TLS with the STARTTLS command. This is used on ports 25 (smtp) and 587 (submission). This mode is in some SMTP stacks simply called "TLS".
If you look around at the questions regarding use of SMTP with TLS you will find lots of confusion about how to use these modes with the various setups. And you will find lots of bad code which tries to use implicit TLS where explicit TLS is needed.
What you see is the result of the client trying to use implicit TLS on a port not suitable for this. \026\003\001 (or hex 16 03 01) is the start of a TLS 1.0 handshake and input sent without waiting for greeting refers to the fact, that the client is sending data first without waiting for the server to send the (plain text) SMTP greeting.
Judging from the error log entry, your mail client 10.7.2.137 is trying to establish a secure (TLS) connection but your Exim server is not expecting it.
Most probably, TLS is not configured properly in your Exim configuration file. You can refer to http://www.exim.org/exim-html-current/doc/html/spec_html/ch-encrypted_smtp_connections_using_tlsssl.html for tutorial.
The solution is, therefore, to edit your Exim configuration file, making sure TLS certificates are defined and tls_advertise_hosts is set; and then restart Exim.
I'm trying to send an email to my IIS (6) SMTP service.
The domain mycustomer.myserver.comis added to the domains list of the SMTP service. Port 25 is open, I can telnet there.
telnet mycustomer.myserver.com 25, gives no errors, but no message either. (other mail servers do show 220).
SMTPDIAG confirms this: Error: Expected "220". Server is not accepting connections.
Failed to submit mail to mycustomer.myserver.com.
Do I need any further configuration of my IIS SMTP to get this to work?
At this point, I do not have MX records, but I don't think that is the problem?
OK found it:
Allowed connections were restricted to localhost, as configured under Access > Connection control.