I have a payment related module in my website. If user cancel payment from paypal, then user get a email that Payment is not completed and if payment is successful then user get Payment success mail.
I am getting issue with mail delivery time.
Case: If user first cancel the payment and return to website from paypal, then user try again to payment and made successful payment.
In this case, user get "Payment success mail" first and "Payment cancel mail" deliver later.
So, can anyone please explain what factors affects email delivery time when mail is sent using php mail() function.