I need the experts help please...

I have a current yellow pages scripts that has an email confirmation function. My host requires smtp authentication and the current script does not allow it. The script looks like this:

function sendmail($to,$subject,$message,$sender,$from) {

$mailheaders = "From:$sender<$from>\n";
$mailheaders = "Reply-To: $sender\n\n";
mail($to,$subject,$message,$mailheaders);

}

What do i need to add to ensure the smtp authentication?

Many thanks!
Monre

    You need to make the jump to using a fully featured mailing class, as php's inbuilt thing is absolute pants.

    Phpmailer is hugely popular and reliable http://sourceforge.net/projects/phpmailer
    and Swiftmailer is newer and really nice http://www.swiftmailer.org/

    Phpmailer tutorial here: http://phpmailer.codeworxtech.com/index.php?pg=tutorial

    You'll need to use the options

    
    	$mailer->isSMTP();
    	$mailer->Host = 'smtp.mail.your.isp';
    
    	$mailer->SMTPAuth = true;
    	$mailer->Username = 'yourusername';
    	$mailer->Password = 'yourpassword';
    
      Write a Reply...