Same basic sendmail trouble shooting steps


A couple of weeks ago our group had to do some email investigation.  In the span of a couple of days we received a series of complaints that our CF server wasn’t delivering email.  Of course the tickets stated that all email wasn’t being delivered – which was an exaggeration – our team was receiving daily system messages via email.  So knowing that not all the email was being served – which was a true complaint, we started the investigation.  First checking the application code, the problem didn’t lay there, it was passing the email to the server’s spool.  Using Ray Camden’s nifty SpoolMail tool we were able to change the email addresses on the failed messages and got them sent through.  With that we knew the problem was ColdFusion related.  So we stepped into the next set of tools to trace the problem.  With the help of our server admin, we setup mailstats on our RHEL box, which is a basic utility that displays the current mail statistics.

Below is the setup, which helped us figure out that our clients were blocking our server, putting us in their whitelist fixed the issue…

	# setup mailstats<
	# ------------------
	touch /etc/mail/statistics
	
	# check aliases - new sendmail defaults to /etc/aliases
	# -----------------------------------------------------
	newaliases
	
	# test outbound email
	# --------------------
	
	# test local mail first
	#---------------------
	echo "Subject: test message # 1" | /usr/lib/sendmail -f john.doe@myserver.com -v jane.doe@testserver.com

	# mail
	# --------------------------
	# test outbound mail second
	# --------------------------
	echo "Subject: test message # 2" | /usr/lib/sendmail -f jane.doe@testserver -v john.doe@myserver.com
	
	
	# check stats (note the "s" at the end of mailstats, mailstat is a different program)
	# -----------------------------------------------------------------------------------
	mailstats
	
	# each line is a mailer, "local" handles local mail, "esmtp" handles internet mail
	# T = Totals from above traffic
	# C = Connections from above traffic
	# generally your "interested" in the line from "right to left" for "esmtp" and the column " msgsto" it should be going up
	# check the mailq
	# ---------------
	mailq
	
	# to reprocess the mqueue
	# ------------------------
	sendmail -q
	
	# to manually delete messages in the mail queue
	# =============================================
	cd /var/spool/mqueue 
	
	# grep for the message file in question
	
	# to look for transmission problems
	# ---------------------------------
	vi /var/log/maillog	

Leave a Reply