This parameter can be changed in Qmail’s control directory. The default setting is to keep attempting to send an email for 7 days. The parameter value is seconds.
If you only wanted to keep emails for 4 days: 4 days * 24 hours * 60 minutes * 60 seconds would equal 345600.
[root@plesklinux control]# ls queuelifetime
ls: queuelifetime: No such file or directory
[root@plesklinux control]# ../bin/qmail-showctl | grep life
queuelifetime: (Default.) Message lifetime in the queue is 604800 seconds.
[root@plesklinux control]# echo 345600 > queuelifetime
[root@plesklinux control]# /etc/init.d/qmail restart
Starting qmail: [ OK ]
[root@plesklinux control]# ../bin/qmail-showctl | grep life
queuelifetime: Message lifetime in the queue is 345600 seconds.
[root@plesklinux control]#