The default VPS2 sendmail configuration checks the mail queues every 30 minutes for mail that it was unable to deliver previously, and tries to deliver those mails again. This document describes how to adjust the retry frequency on a Virtual Private Server Version 2 (VPS2). It also works on a standard FreeBSD server.
The length of time between mail queue checks is specified as a startup option to sendmail--it must be specified when the sendmail daemons are started (or restarted). Some typical values for that option are -q15m, -q20m, -q30m and -q1h, which cause sendmail to check the queue every 15, 20, 30 or 60 minutes. (The last example could have been specified -q60m instead of -q1h.)
The easiest way to change sendmail's startup parameters is to modify lines in the file /etc/rc.conf. (Unless you tell your VPS otherwise by modifying lines in /etc/rc.conf, FreeBSD uses the values it finds in /etc/defaults/rc.conf. You shouldn't edit /etc/defaults/rc.conf; modify /etc/rc.conf instead.)
Assuming that you haven't added any lines to your /etc/rc.conf that mention sendmail (and you haven't changed /etc/defaults/rc.conf), you can add these two lines to /etc/rc.conf, and it will shorten the time between queue checks to 15 minutes:
sendmail_flags="-L sm-mta -bd -q15m" sendmail_msp_queue_flags="-L sm-msp-queue -Ac -q15m"
The above lines are identical to what is in /etc/defaults/rc.conf, except that I changed "-q30m" to "-q15m" (to shorten the time between queue checks from every 30 minutes to every 15 minutes. (Adjust the 15-minute interval to other intervals--at your own risk, of course! :-)
The first line is for e-mail queued in /var/spool/mqueue; the second is for mail queued in /var/spool/clientmqueue. (Depending on where your problem mail is queued, you might need to use only one of the lines above.)
After adjusting /etc/rc.conf, you will want to restart sendmail, with the commands:
# cd /etc/mail # make restart
You can verify the arguments used to start the current sendmail MTA (Mail Transfer Agent--the one that uses /var/spool/mqueue) by issuing the following command and looking at the second line of output (checking for "-q15m" or whatever interval you specified):
# cat /var/run/sendmail.pid
To do the same for the submission daemon, issue the command:
# cat /var/spool/clientmqueue/sm-client.pid
and look at its second line of output.
Whenever you modify any sendmail arguments or configuration values, you should monitor sendmail to make sure that you haven't adversely affected its behavior. Look in /var/log/maillog to make sure that sendmail is in fact running, try sending some messages to your server, etc.
If the number of queued messages becomes too great, you might need to examine values of the Timeout.queuereturn option (and other configuration values) in the sendmail configuration file.