An Improved Transformer-based Model for Detecting Phishing, Spam, and Ham: A Large Language Model Approach