why im getting the mails in spam? i wnt them them to be in my inbox? is there a way to fix this?
Most likely, you aren’t setting your email headers properly. For example, emails where the “From” (or “Sender”) doesn’t match the domain that sent the email are frequently flagged as spam. Your mail server might not have a god sending reputation. There are any number of other possible causes.
As @Junaid_Farooq says, we’d need to see the code.
(In the meantime, when you get these emails in your Spam box, have you tried marking them as “Not Spam” or adding your “From” (or “Sender”) address as “Safe”?)