Prevent remote email from my own domain

gramzon

Member
Dec 4, 2017
19
3
3
Croatia
cPanel Access Level
Root Administrator
How can I block incoming email from remote servers with "mail from: *@mydomain.com" header where mydomain is a domain hosted on my server?
I tested this by executing
Code:
telnet mydomain.com 25
from a different server and set
Code:
The e-mail is accepted.
If I set the "rcpt to:" header to a remote domain, then the server properly responds with 550 not permitted to relay, because all users are required to authenticate to relay through my server, but I want all users to be forced to authenticate if the "mail from:" is a local address as well, regardless of recipient.
 
Last edited:

cPanelLauren

Forums Analyst II
Staff member
Nov 14, 2017
8,041
652
263
Houston
cPanel Access Level
DataCenter Provider
SPF and DKIM are in place to limit the ability of mail being sent this way. If the host isn't authorized to send for your domain it should fail SPF, same issue if the DKIM signature isn't found. You can also choose to deny DKIM failures in Exim.

What it sounds like you're referencing is a relay: Stop Mail Relay - this thread goes over open relays.