Hi @Ghulam Abbas,
Please refer to the following link for detailed guide:
How to set up a multifunction device or application to send email using Microsoft 365 or Office 365
In short, if you would like to use basic authentication, you may need to disable security defaults.
(Security defaults works on tenant-level so even if you enable SMTP auth for a specific mailbox, it still doesn't work)
If possible please consider using modern auth or refer to Option 3 in the link to create a receive connector for the devices and applications.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.