I am creating a "Contact us" page with a form.
Upon submission, a PHP script will send two emails:
The first email is the support message, which is sent to us;
the second is a confirmation email to the user.

How could I program a PHP script to send these emails and verify that the emails were sent successfully?

It is very important that the customer is notified if their message does not go through successfully.