Pages

Tuesday, February 7, 2012

Sendmail

  • verify the user IDs: sendmail -bv
  • verbose mode:
> (echo "From: xxx.yyy@`hostname`"
echo "To: aaa.bbb@host.com"
echo "Subject: test1"
echo $(date)
) | sendmail -v -t -f send@host.com
  • lookup ns & mx:
> host -n google.com
google.com has address 74.125.159.99
google.com has address 74.125.159.103
google.com has address 74.125.159.104
google.com has address 74.125.159.105
google.com has address 74.125.159.106
google.com has address 74.125.159.147
google.com mail is handled (pri=40) by alt3.aspmx.l.google.com
google.com mail is handled (pri=50) by alt4.aspmx.l.google.com
google.com mail is handled (pri=10) by aspmx.l.google.com
google.com mail is handled (pri=20) by alt1.aspmx.l.google.com
google.com mail is handled (pri=30) by alt2.aspmx.l.google.com

  • debug mode:
> sendmail -bt
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter

> 3,0 xxx@yyy.com


Online Network Tools: http://centralops.net/co/


  • /etc/hosts works with host or ping
  • nslookup looks at DNS server (default domain=Name is the value specified in the system's hostname, /etc/resolv.conf, or LOCALDOMAIN file)

What are MX Records? (source: http://mx-records.e-dns.org/)

Mail exchange (MX) records are resources maintained by a domain name system (DNS) that route email traffic to the correct mail server. Just as DNS helps point browsers to the correct IP address for retrieving web pages, MX records are the part of the DNS that help email messages reach their final destination. Remember from our article on Domain Name Systems that a domain name, such as example.com, is not an address in itself. Instead, a domain name is a reference to the IP address. As you know, email addresses include a username, or mailbox and a domain name separated by an @ sign, e.g. name@example.com. MX record ensures that incoming mail gets routed to the correct mail server that’s associated with the domain name portion of an email address.

When you send an email, your mail transfer agent sends a request to the DNS for the domain to look up the MX records. The MX records will relay the hostnames where mail is being accepted to the mail transfer agent. Once the hostname is determined, your mail transfer agent can make an SMTP connection with the recipient’s mail server in order to send the email.

Oftentimes, there will be multiple MX records for each domain. This is to provide backup mail exchange records in case the primary server gets overloaded or is temporarily down. Also, MX records are where spam filtering software is located. Before resolving the recipient’s domain name for your mail transfer agent, the spam software will analyze your message for signs of malicious content, viruses or evidence of spam. MX records will often reference blacklists, which is list of domains or hosts for known or suspected spammers. Emails from these sources will be rejected on the mail server level.

Occasionally, legitimate email users may be added to one or more blacklists. If this occurs, the IP blacklist lookup tool can be helpful for checking to see which, if any, blacklists your domain is on. If your domain or IP address appears on an DNS blacklist, you can usually contact the party that maintains the blacklist to have it removed.

If you want to check to see which mail server an incoming email is coming from, you can use the MX records lookup tool. Spammers often send spam from fake email addresses. If the MX records lookup tool cannot find any mail servers for an email address, it may mean that the email address is spoofed or invalid. You can also check to see if the mail is coming from a mail server that has been blacklisted by cross-referencing it on the IP blacklist lookup tool.