Setup mail server that may send emails to inbox

proogammer

Member
Dec 19, 2011
23
0
51
cPanel Access Level
Root Administrator
I have setup all other part of my server except "mail server" and I need help to set it up. Those documentations found in website does not provide enough info.

I have two ip addresess(suppose):
190.123.123.123
190.133.333.333


My webserver is setup at 190.123.123.123 and this is the ip that i use to access my WHM.

My nameservers are:

ns1.domain.com -> 199.133.333.333
ns2.domain.com -> 190.123.123.123


Now I have domain hosted "www.domain.com" in my server and when I try to send email from "[email protected]" my emails are sent to spam/junk folder and I don't want this to happen.

Please help me to setup my mail server and smtp so my emails may not be marked as spam or junk.

Thanks
 

faisikhan

Well-Known Member
Dec 12, 2011
86
0
56
Islamabad, Pakistan
cPanel Access Level
Root Administrator
Hi,

Email spamming is one of the major problems in Email Communication World whose major reasons & solutions can be one of these:
1. Mail server IP address is black-listed (You can black list check using Multi-RBL Check Results | The Anti-Abuse Project) and give there your main mail server IP address and if in case it is found black-listed in any of the RBLs then go to each RBL and request for the removal of your IP, also it would be better to change the Email server IP address.

2. Check either your email server is trying to send large number of messages & identify the source of email or detect the address.

3. Review all the email headers to determine the true origin of the emails, with email headers I bet you will be able to find the 50 % reasons of spamming.

4. Do not reply to the spam messages & increase the server security as well.

5. Disable emails from "nobody" user in C-Panel/WHM.

6. Also tail the mail server logs and server logs(tail -f /var/log/messages) for further info and paste some output here so that I can further check :)
 

proogammer

Member
Dec 19, 2011
23
0
51
cPanel Access Level
Root Administrator
I have provided supposed domain name and ip addresses and have explained problem and now I need to know it from scratch to how to setup the mail server according to the info I have provided.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
You can enable SPF and domainkeys in cPanel > Email Authentication area to improve your domain's scoring and reduce the likelihood of being tagged as junk or spam.

If you want to enable it for all domains on the machine, you could run this command:

Code:
for x in `ls -A /var/cpanel/users`;do /usr/local/cpanel/bin/domain_keys_installer $x && /usr/local/cpanel/bin/spf_installer $x ;done
If you want all domains to have it on account creation, you can do the following:

Code:
touch /usr/local/cpanel/scripts/postwwwacct
chmod +x /usr/local/cpanel/scripts/postwwwacct
Put the following into the /usr/local/cpanel/scripts/postwwwacct file:

Code:
#!/usr/bin/perl

my %OPTS = @ARGV;
$ENV{USER} = “$OPTS{‘user’}”;
system q(/usr/local/cpanel/bin/domain_keys_installer $USER);
system q(/usr/local/cpanel/bin/spf_installer $USER);
Next, is the main server IP being used to send the emails? If so, then check that the server's hostname matches the reverse DNS (rDNS) for the IP:

Code:
hostname -f
dig -x IP# +short
Above please replace IP# with the server's main IP number.

Finally, can you state if all servers are receiving the domain's messages to spam or junk or only some servers? If it is a server like yahoo or hotmail, then having SPF records, domainkeys and a matching rDNS with the hostname should help.
 

proogammer

Member
Dec 19, 2011
23
0
51
cPanel Access Level
Root Administrator
I have enabled domainkeys and and SPF for my domain I also executed the command:
hostname -f
dig -x 190.123.123.123 +short
(*it is just and example ip here)

Emails are not marked as spam in gmail but for hotmail it is still marked as junk.

I am unclear about this rDNS part.

my hostname is:server.domain.com

In my DNS Functions -> Edit DNS Zone domain.com->edit

mail - 14400 - IN - CNAME - domain.com.

Above is the setting for mail is it correct?
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
If the domain is sending from the main IP of the machine, then you need the rDNS for the IP (the PTR record for the IP) to match the hostname. Hosts typically perform sender verify and, if the hostname doesn't match the IP's PTR record for the reverse DNS, then they will often either reject the message or place it into spam.

Does the hostname match the return for the dig for the IP?
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
The IP you noted does not have any PTR record setup for it for rDNS at all. That is why if you put in "dig -x IP# +short" you won't even get a reply as there is not answer section showing. Compare that to this Google IP when you do the same thing:

Code:
# dig -x 74.125.227.83 +short
dfw06s07-in-f19.1e100.net.
Any IP that doesn't have a response with +short added to the IP dig doesn't have a PTR setup. Your emails will most definitely go to spam if you don't have a PTR record for the IP. Only the provider of the IP can set the reverse DNS (PTR) for the IP. You will need to contact your hosting provider, datacenter or NOC, whoever provided the IP, to ask they setup the IP to match your hostname.
 

proogammer

Member
Dec 19, 2011
23
0
51
cPanel Access Level
Root Administrator
My IP provided setup my reverse dns now I got the following out for commands:

#hostname -f
server.domain.com

# dig -x IP# +short
server.domain.com.
my reversed has only additional "."(dot) at its end. Still hotmail is marking my email as junk.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
You are always welcome to open up a ticket to us for us to check everything is properly configured per how you would like it setup. If everything is properly configured and it still is marked as junk by hotmail, you'll have no choice but to contact them directly to ask why.

You can submit a ticket in WHM > Support Center > Contact cPanel or using the link in my signature. Please post the ticket number here upon sending one to us. Thanks!
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
I rather not close the thread as it would be better for anyone else reading it to know the results of the ticket after it is resolved.