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

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.

Related

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.

Cannot send/receive mail on plesk server

I have just had to re-image my server and for some reason, when I do a test connection in outlook, it errors on both send/receive with could not connect to server.
I have checked that both postfix and courier-imap are running on the server and have restarted both just to make sure. I am using plesk 12 and have setup users for the email system, so would appreciate some guidance as to how I can troubleshoot this. Many thanks
SOLVED
Reset iptables all good now

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.

CentOS Spam Troubleshot

I am having a problem in my server. It's sending a lot of spam emails out. I am using Exim, and i did all the possible Tweaks from WHM to prevent spamming. I already tried to find the source of these email, from what script they are coming from.
I tried with TCPdum and netstat.
The emails are going out from some cPanel user for example user1#servername.sdm.com (the server host name) not from user#samedomain.com.
Any idea or suggestion what can i check?
I already found the problem. I was monitoring with TCP dump the connections in port 25 and grepped the account what was spamming than i found what script was sending the emails by monitoring the Exim logs.

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

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