Adding SPF records for a user via SSH in Cpanel servers
SPF (Sender Policy Framework): A feature that allows a recipient server to verify that an email message has really been sent from the domain specified in the From: field. Enabling SPF can prevent your server from receiving replies to spam that has forged your domain name as part of the sender’s address. SPF only works if both the sending and receiving mail servers have SPF enabled.
Login to your cpanel server as root user.
/usr/local/cpanel/bin/spf_installer USERNAME
SPF record
An SPF record is simply a TXT type dns record which is used to store information about what IPs are allowed to send email for a specific domain. A receiving mailserver can do a lookup on this TXT record get get this data, and use the information to decide if an IP sending email from a specific domain really is allowed to be sending email for that domain.
There are a few options you can use with SPF records to govern the severity of encforcement on these rules.
Details on these rules can be found here: http://www.openspf.org/SPF_Record_Syntax
Setup your SPF record to use the -all option insetad of the ?all option so that email can *only* be sent from your server. This means that you *must* get all of your clients to send their smtp through your server, or they will be tagged as spam for spoofing. If they’re blocked on port 25 to your server, tell them to send on port 587 to your server (same thing, just not block by the ISP) value of -all, you can either change your DNS zone manually from:
Directadmin-> Admin Level -> DNS Administration -> domain.com or User Level -> DNS Management
change:
“v=spf1 a mx ip4:4.2.2.2 ?all”
to be
“v=spf1 a mx ip4:4.2.2.2 -all”
of course, where 4.2.2.2 should be replaced by your server IP.
Restart named after making the changes. Allow at least 4 hours for the new records to propogate.