[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 248
  • Last Modified:

sendmail issue: multiple mailqueues - load balancer

Hi All,

If someone can send me a very informative link that can help me to underdstand the following with examples

1 . sendmail logs (/var/log/maillog)
2 . mailq
3 . how to check the deffered mails?
4 . how to check the rejected emails?
5 . how to resend the deferred and rejected emails?
6 . how can we count how many emails went successful / rejected / deferred in a day?
7 . how can we set and manage the multiple mailqs?
8 . understand /var/mail/mqueue (enteries starting with qf/df/Qf/tf )
9 . understand /var/mail/clientmqueue
10. shared mail server? (load balancer)

I am crazy to learn sendmail fully as in the new office sendmail is being used which i never used :-(
I will really appreciate if someone can help me to sort out these issues.

Many thanks.

1 Solution
If you're new to sendmail and really want to learn everything about how it works, I'd suggest you buy a book and read it. However many of your questions are pretty simple to answer:

1. the logs show all mail traffic (in and out) and most information about the message. You'll see the date, the message id, the process id handling the mail, the To addr, the From addr, the size, the number of recipients, and the relay, which is just the server that submitted the mail if it's an incoming msg or the server that accepted it if it's an outgoing message. Keep in mind there will be multiple log entries for each message, and they can overlap each other, so look at the message id to keep track of which log entries go together or relate to the same mail.

2. mailq simply shows you what is currently in the queue. If the message has been deferred or tempfailed, it'll list the reason in between the sender and the recipient.

3. Use mailq to check deferred mail. They'll have "(Deferred:" listed in the reason.

4. Really the only way to check on rejected msgs is to look in the /var/log/maillog file. Do a search for the term "reject" or search for status codes in the 500s (5.[0-9].[0-9]). 500s are permanent failures, 400s are temporary failures and will be retried.

5. To force the queue runner, type "sendmail -q", but they'll be resent automatically, but you can force it that way. You can't resent rejected mail, the server discards it. Only the original sender can resend, but chances are, it's going to get rejected again.

6. Use the mailstats program to keep counts. It tells you the number of messages to, from, rejected, discarded, in the queue and the total bytes in and out. Write a shell script to run from a cron job to parse the output of mailstats to build a db of daily stats.

7. This should give you an idea about multiple queues: http://www.ducea.com/2008/08/19/sendmail-multiple-queues/

8. qf files are the headers, df files are the msg bodies. There should be two files (1 qf and 1 df) for each message in the queue.

9. First, mail gets dumped into the mqueue folder for processing. If it isn't delivered promptly it gets moved to the clientmqueue folder for later retries afaik.

10. I'm not quite sure what you're asking on this one, but for load balancing basically you just need multiple sendmail boxes all listed as MX records (with the same priority) or just using roundrobin dns (1 name points to multiple IPs). If you want all the servers to share a common queue or mailbox folder, you'll have to map that location from yet another shared server using NFS or CIFS .

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now