3 method can be used to remove all the sendmail queue in Solaris. Before start to remove all the sendmail queue files in the Solaris, you are advise to stop the sendmail process and start it back once done. Follow below commands to stop and start the sendmail process.
# /etc/init.d/sendmail stop # /etc/init.d/sendmail start
• Go to spool mail directory and remove all the files inside. This method will automatically remove all the files in the mqueue directory.
# cd /var/spool/mail/ # ls -lrt # rm -rf /var/spool/mail/*
• Go to mqueue directory. Remove all the mail files inside. (same like above method)
# cd /var/spool/mqueue/ # ls -lrt # rm -rf /var/spool/mqueue/*
• Execute sendmail command with the options -q and -v. This command will resulted to delete all the pending sendmail in the system.
# sendmail -q -v
Additional to above method, you can also delete a particular user or domain mail in the system. In this example, I’ll show the command to remove all the mails that been sent from the gmail.com.
# sendmail -qR -v gmail.com