Why we need to smtp authentication to send mail ? To Stop spam and stop phishing emails .
Here you found all steps below
Login to cPanel and install PHP PEAR Packages .cPanel -> email and create email account . That email account will be SMTP User name and Password is SMTP password , So note this
Now You can found below sample php and html code . also here is clase file . please use this to send mail .
Host name will be your domain or your IP address as we provider when you place order . ( new account infromation )