Moved logic for getting emails to be sent to mail.get_queued().