How do I fix "501 Syntactically invalid HELO argument(s)"? - email

I'm using exim on both the sending and relay hosts, the sending host seems to offer:
HELO foo_bar.example.com
Response:
501 Syntactically invalid HELO argument(s)

Possibly a problem with underscores in the hostname?
http://www.exim.org/lurker/message/20041124.113314.c44c83b2.en.html

Underscores aren't actually valid in internet host names, despite some people using them anyway. A sane DNS server should not allow you to have records for them.
Change your system's host name so it's valid, hopefully this will fix it.

After spending so many hours trying to fix this problem, which in my case just come up from nothing, I ended up with a solution. In my case, only the systems deployed to Suse OSs suddenly stopped sending emails but not those ( the same ) running on Ubuntu. After exhausting and eliminating all the suggested possibilities of this problem and even considering to change de OS of those machines, I found out that somehow the send email service is sensible to the hostname of the host machine. In the Ubuntu machines the file /etc/hosts have only the following line:
127.0.0.1 localhost
and so were the Suse machines, which stopped sending the emails. After editing the /etc/hosts from Suse machines to
127.0.0.1 localhost proplad
where proplad is the hostname of the machine, the errors were vanished. It seems that some security policy ( maybe from the smtp service ) uses the hostname information carried through the API, which was being ignored in the case of the Ubuntu machines, but not in the case of Suse machines. Hope this helps others, avoiding massive hours of research over the internet.

Diago's answer helped me solve the problem I have been trying to figure out.
Our Suse OS also stopped working out of nowhere. Tried every suggestion that I found here and on google. Nothing worked. Tried adding our domain to etc/hosts but that did not help.
Got the hostname of server with the hostname command. Added that hostname to the etc/hosts file just like Digao suggested.
127.0.0.1 localhost susetest
I saved the changes, then ran postfix stop, postfix start. And works like a charm now.

The argument to HELO should be a hostname or an IP address. foo_bar.example.com is neither an IP address nor a hostname (underscores are illegal in hostnames), so the error message is correct and there is nothing to fix.

Using qmail I came across this problem. I realised this was because of a previously unfinished installation.
1) When sending email qmail announces itself to other SMTP servers with "HELO ..." and then it adds what is in the file at: /var/qmail/control/me
(sometimes the file is located at /var/qmail/control/helohost)
2) This file should have a hostname with a valid DNS entry in.
Mine did not it had (none) which is why mails were failing to be sent.

I found that my local dev server suddenly stopped sending emails (using external SMTP) and on the server logs I found:
rejected EHLO from cpc96762-*******.net [..**.68]: syntactically invalid argument(s): 127.0.0.1:8888/app_dev.php
127.0.0.1:8888/app_dev.php is my local URL, I am using Docker, Symfony and Swift Mailer.
The only solution that helped in my case was adding the parameter:
local_domain = "localhost"
to my Swift Mailer configuration. That solved all the problems.
See the docs for the Swift Mailer local_domain option: https://symfony.com/doc/current/reference/configuration/swiftmailer.html#local-domain

Related

Configure root#localhost mail on postfix dovecot postfixadmin virtual mail server using postgresql freebsd 12

Using freebsdI I setup a postfix, dovecot, postgresql and postfixadmin virtual email server. Everything is working to my satisfaction except email to root#localhost and my user email to localhost. Having done a lot of investigation and some trial I'm not finding the answer.
I looked at mydestination I have localhost listed, I think that is correct.
I tried adding localhost as a postfixadmin domain, this fails the x.x edit. localhost. does not work either. Don't really want to change code for obvious reasons. Localhost will resolve to the correct local ip 127.0.0.1.
Tried using mail to send root#localhost and get a dead.letter file with the message in it.
I am not a email server expert only the first time I've done this so much learning to do.
how do I solve this issue?
Thanks in advance for your help.

How to configure a sendmail to relay email from and to a mail server

I've a full server with mail and web behind a dynamic IP access.
This is all configured to update the ip in case it changes and works well with everything except mail.
Although I've implemented SPF DKIM and DMARK, since the address are listed in PBL, many servers refuse the connection.
I'm trying to solve this issue setting up a relay machine for my domains in a small VPS with Fixed IP and Reverse DNS to avoid PBL's.
I've found a link from a guy that implemented a similar solution, but he changes the sendmail.cf file, that is not supposed to be touched.
This link:
https://www.akadia.com/services/sendmail_relay.html
How can I do this in the sendmail.mc file for compilation with m4?
My idea is to set the mx records pointing to this vps acting as relay, and also configure my postfix mailserver to forward mail to the relay, which I think I've found were to do this in webmin.
Hope someone can shed some light in my head.
Thanks in advance.
You can specify default relay for outgoing email in sendmail.mc file using SMART_HOST.
define(`SMART_HOST', `name.of.smart.host')dnl
Useful tip: You may put smart host name in square brackets to avoid lookup for DNS MX records.
define(`SMART_HOST', `[name.of.smart.host]')dnl
WARNING
sendmail uses *.cf files as configuration. *.mc fIle must be "compiled" into *.cf file.

ATSPACE.COM has broken HELO / EHLO command for SMTP transaction?

SMTP connection from my laptop to my ISP has worked fine for years when my computer sends "EHLO [10.0.0.107]" to introduce itself. It happens to be a Mac OSX using Mail, but that's irrelevant because I'm typing the tests manually using telnet command line, tested from a Mac, a Win10, even a Pi, and also from elsewhere in the nation.
Recently my for-pay ATSPACE.COM SMTP server has begun failing with a "#103b" error as soon as I complete the "rcpt to:" command in the SMTP conversation. I've traced this back to the EHLO command because any other fully qualified domain name submitted with the EHLO command works without a #103b error -- even domain names that have nothing to do with me.
I've also tried SMTP conversation with another ISP SMTP server (1and1.com) using the identical commands and everything works fine.
Two questions:
1) If you have an ATSPACE.COM account, can you test your SMTP capability manually with telnet and post a log of your command line conversation? Please mask out your username and password before posting it.
2) I think submitting my local IP with the EHLO command is okay (it worked for years with atspace and still works with 1and1) and I know submitting any other URL works fine. Can you point me toward a reference that says submitting a local IP address is within specs? I need to press this point with atspace tech support which has run me around the pole for about a month now.
Any help appreciated!
From RFC5321:
2.3.5. Domain Names
(...) The domain name given in the EHLO command MUST be either a
primary host name (a domain name that resolves to an address RR) or,
if the host has no name, an address literal (...)
4.1.3. Address Literals
Sometimes a host is not known to the domain name system and
communication (and, in particular, communication to report and repair
the error) is blocked. To bypass this barrier, a special literal form
of the address is allowed as an alternative to a domain name. For IPv4
addresses, this form uses four small decimal integers separated by
dots and enclosed by brackets such as [123.255.37.2], which indicates
an (IPv4) Internet Address in sequence-of-octets form. (...)
But then in 7.9:
It is a well-established principle that an SMTP server may refuse to
accept mail for any operational or technical reason that makes sense
to the site providing the server. (...)

Mail not getting send to specific domains

We have a VPS with CentOS combined with DirectAdmin which we use for a Magento shop. This runs fine, except for sending email.
Problem:
It appears that some specific domains won't receive our emails and we get a bounce. If we use any other email sending systems, the mails arrive without problems.
The bounce mail contains the following error:
SMTP error from remote mail server after HELO Company-Shops:
host mx-cluster-b2.one.com [IP ADRESS]: 504 5.5.2 :
Helo command rejected: need fully-qualified hostname
After googling and trying things for a week now, I am a bit lost. I tried checking postfix in CentOS, but this is not installed and I'm not quite sure if this is needed.
Possible issue?
I believe the hostfile in CentOS is setup incorrectly:
127.0.0.1 localhost localhost.localdomain localhost4 ... etc
OUR IP Company-Shops
'Company-Shops' should probably be a domain name, am I right? The same as the rDNS. But I'm afraid if I change this it will kill my site and whatnot. I'm not sure if this entry correlates with the 'company-Shops' helo label in the bounce error.
Some extra info:
- We use the webmail Roundcube from DirectAdmin
- At the moment we run one shop, but this might grow a bit (multiple sites on 1 IP)
- We don't use subdomains
- We've set up a reverse DNS, with the domain
Is there anyone with similiar experiences or with a bit more knowledge about this subject? I appreciate any advice we can get, as we are stuck..
Many thanks.
Yes, that's right: your mail server should identify itself using a fully-qualified domain name when it connects to send mail via SMTP. You don't say what mail server you're running, but since you're using DA, it's probably Exim. If so, you want to edit /etc/exim.conf and set primary_hostname to the FQDN of your server.
This would also be a good time to double-check that reverse DNS is set up properly for your IP address. Many hosts will also reject email from servers on IPs without a valid rDNS record.
I'm not familiar with Magento, but I can't see any way that changing the Exim configuration in this way could impact that program.

EXIM4 configuration not working for only 1 machine.

Here is the deal.
We have a printer and all our machines have debian in our office. I've configured the printer to send mails to the server (pc00) via its IP (which is static). I created a hubbed_hosts file that tells exim each machine, which IP it has. So my own personal mahcine is ariela#pc01 since I have pc01 and my username is ariela. This should get received in the mbox file. This works in every other machine except mine.
If I print the exim log I get:
ariela#pc01 R=hubbed_hosts T=remote_smtp defer (-44): SMTP error from remote mail server after RCPT TO:<ariela#pc01>: host 192.168.2.101 [192.168.2.101]: 451 Temporary local problem - please try later
It seems as if the problem is in my client machine, howerver I've runned the exim4-config with dpkg-reconfigure for my machine and It is the exact same things as the others that do work. I'm clueless.
Any help would be appreciated.