It is successfully sending emails. But the problem is that the emails are going to the spam folder. The reasons may be:1. phpmailer sends out emails without authenticating with the mail server.2. The headers are not correct.

I have checked the header of the email arrived in the Spam folder. It doesn't have spf and dkim "pass". So I just thought of some iRedmail API that I can call instead of calling the phpmailer's API. Please suggest.