Salve a tutti,
avrei bisogno di aiuto per creare un form contatti in Php con l'autenticazione Smtp,
possibilmente utilizzando Phpmailer.

Quello che ho fatto fino ad adesso è questo :

Contatti.Php:


Codice PHP:
<div id="contacts">
  <div id="contactsForm" >
  <h1>Contattami:</h1>  
  

I campi contrassegnati con (*) sono obbligatori</p>         
  <form action="mail.php" method="post">
    <table width="240" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="240" align="left" valign="middle"><p class="contactform">Nome: *
          <span style="color:#F00"><?php echo $_SESSION['nameerror'?></span>

          <input name="name" type="text" id="name" value="<?php echo $_SESSION['name'?>" maxlength="50"/>
          </p></td>
        </tr>
      <tr>
        <td width="200" align="left" valign="middle"><p class="contactform">Email: *
          <span style="color:#F00"><?php echo $_SESSION['emailerror'?></span>

          <input name="email" type="text" id="email" value="<?php echo $_SESSION['email'?>" maxlength="100" />
          </p></td>
        </tr>
      <tr>
        <td colspan="2" align="left" valign="middle"><p class="contactform">Oggetto: *
          <span style="color:#F00"><?php echo $_SESSION['subjecterror'?></span>

          <input name="subject" type="text" id="subject" value="<?php echo $_SESSION['subject'?>" maxlength="100"/>
          </p></td>
        </tr>
      <tr>
        <td colspan="2" align="left" valign="middle"><p class="contactform">Messaggio: *
          <span style="color:#F00"><?php echo $_SESSION['messageerror'?></span>

          <textarea name="message" cols="40" rows="3" id="message"><?php echo $_SESSION['message'?></textarea>
          </p></td>
        </tr>
      <tr>
        <td colspan="2" align="left" valign="middle"><p class="contactform">Indica il risultato di 2+4 *  
          
          <select name="humancheck" id="humancheck">
            <option value="---">---</option>
            <option value="no">12</option>
            <option value="yes">6</option>
            </select>
          <span style="color:#F00"><?php echo $_SESSION['humanerror'?></span>

          </p></td>
        </tr>
      <tr>
        <td colspan="2" align="left" valign="middle"><input class="btn" type="submit" name="button" id="button" value="Invia" />
          <span style="color:#F00"><?php echo $_SESSION['senderror'?></span>
</td>
        </tr>
      </table>
    </form>
  </div>

Config.php:

Codice PHP:

<?php

//Your email address e.g. "you@here.com"

$youremail        =     "info@hunkaryilmaz.com"    ;


//Your website e.g. "website.com"

$yourwebsite    =    "www.hunkaryilmaz.com"    ;


//Path to your logo e.g. "http://www.yoursite.com/images/logo.jpg"
//(Recommended size 255 x 124px)

$logo            =    ""        ;


//Thankyou page address e.g. "thankyou.php"

$thankyoupage    =    "thankyou.php"    ;

//Contact form page e.g. "../form.php"

$contactpage     =    "contatti.php"        ;


//Return to home address after visiting the thankyou page e.g. "../index.php"

$returnhome        =     "mail.php"    ;

?>

Mail.php:

Codice PHP:

<?php

//Includes user settings
include('config.php');

session_start();

$name         =     $_POST['name'];
$email         =     $_POST['email'];
$tel         =     $_POST['tel'];
$human         =     $_POST['humancheck'];
$message     =     $_POST['message'];
$callback     =     $_POST['callback'];
$subject     =     $_POST['subject'];
$ip            =    $_SERVER['REMOTE_ADDR'];
$error         =     false;

//Reset error messages
$_SESSION['emailerror']     =     "";
$_SESSION['nameerror']         =     "";
$_SESSION['subjecterror']     =     "";
$_SESSION['messageerror']     =     "";
$_SESSION['humanerror']        =    "";
$_SESSION['senderror']        =    "";

//Validation Session Variables
$_SESSION['message']         =     $message;
$_SESSION['tel']             =     $tel;
$_SESSION['name']             =     $name;
$_SESSION['email']             =     $email;
$_SESSION['subject']         =     $subject;

//Validation

if($name == ""){
    
    
$_SESSION['nameerror'] = "";
    
$error true;
    
}

if(!
eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"$email)) {
    
    
$_SESSION['emailerror'] = "";
     
$error true;
    
}

if(
$email == ""){
    
    
$_SESSION['emailerror'] = "";
    
$error true;
    
}

if(
$subject == ""){
    
    
$_SESSION['subjecterror'] = "";
    
$error true;
    
}

if(
$message == ""){
    
    
$_SESSION['messageerror'] = "";
    
$error true;
    
}

if(
$human != "yes"){
    
    
$error true;
    
$_SESSION['humanerror'] = "";
    
}

if(
$error == true) {
    
    
$_SESSION['senderror'] = "";
    
header("Location: $contactpage");
    exit;
    
} else {
    

$to         $youremail;
$sbj         "You have recieved a message - ContactKing";
$msg         "
<html>
<head>
<style type='text/css'>
body{
    font-family:'Lucida Grande', Arial;
    color:#333;
    font-size:15px;
}
</style>
</head>
<body>
[img]"
."$logo"."[/img]
<table width='600' border='0' cellspacing='0' cellpadding='5'>
  <tr>
    <td width='121' align='right' valign='baseline'>[b]Name:[/b]</td>
    <td width='459'>
$name</td>
  </tr>
  <tr>
    <td align='right' valign='baseline'>[b]Email:[/b]</td>
    <td>
$email</td>
  </tr>
  <tr>
    <td align='right' valign='baseline'>[b]IP:[/b]</td>
    <td>
$ip</td>
  </tr>
  <tr>
    <td align='right' valign='baseline'>[b]Contact Number:[/b]</td>
    <td>
$tel</td>
  </tr>
  <tr>
    <td align='right' valign='baseline'>[b]Call back?:[/b]</td>
    <td>
$callback</td>
  </tr>
  <tr>
    <td align='right' valign='baseline'>[b]Subject:[/b]</td>
    <td>
$subject</td>
  </tr>
  <tr>
    <td align='right' valign='baseline'>[b]Message:[/b]</td>
    <td>
$message</td>
  </tr>
   <tr>
    <td></td>
    <td></td>
  </tr>
    <tr>
    <td></td>
    <td>[size="
1"]Powered by ContactKing | &copy; Copyright 2010 creativeben.co.uk[/size]</td>
  </tr>

</table>
</body>
</html>
"
;

$from          $email;
$headers     'MIME-Version: 1.0' "\r\n";
$headers    .= 'Content-type: text/html; charset=iso-8859-1' "\r\n";
$headers     .= "From: $from";


mail($to,$sbj,$msg,$headers); //Send to you.

//END OF EMAIL TO ME

//START EMAIL CONFIRMATION

$toClient         $email;
$msgClient         "
<html>
<head>
<style type='text/css'>
body{
    font-family:'Lucida Grande', Arial;
    color:#333;
    font-size:15px;
}
</style>
</head>
<body>
[img]"
."$logo"."[/img]
<table width='600' border='0' cellspacing='0' cellpadding='5'>
  <tr>
    <td width='117' align='right' valign='baseline'>[b]Thank you,[/b]</td>
    <td width='463'>
$name</td>
  </tr>
   <tr>
    <td></td>
    <td>We have recieved your message and will get back to you as soon as possible.</td>
  </tr>
    <tr>
    <td></td>
    <td>[size="
1"]Powered by ContactKing | &copy; Copyright 2010 creativeben.co.uk[/size]</td>
  </tr>

</table>
</body>
</html>
"
;
$fromClient      $email;
$sbjClient         "Thank you, $name - $yourwebsite";
$headersClient     'MIME-Version: 1.0' "\r\n";
$headersClient    .= 'Content-type: text/html; charset=iso-8859-1' "\r\n";
$headersClient     .= "From: $fromClient";

mail($toClient,$sbjClient,$msgClient,$headersClient); //Send to Client.

//END EMAIL CONFIRMATION

//Reset error messages
$_SESSION['emailerror']     =     "";
$_SESSION['nameerror']         =     "";
$_SESSION['subjecterror']     =     "";
$_SESSION['messageerror']     =     "";
$_SESSION['humanerror']        =    "";
$_SESSION['senderror']        =    "";

//Reset Validation Session Variables
$_SESSION['message']         =     "";
$_SESSION['tel']             =     "";
$_SESSION['name']             =     "";
$_SESSION['email']             =     "";
$_SESSION['subject']         =     "";

session_destroy();

header("Location: $thankyoupage");
exit;

}

?>

e il file Thankyou.php:

codice:
<?php include('config.php') ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Hunkar Yilmaz - Grazie</title>

<style type="text/css">

body {
background:#FFF;
font-family:Arial, "Helvetica", sans-serif;
color:#414240;
font-size:14px;
margin:0;
padding:0;
}

#wrap {
width:400px;
text-align:center;
border:1px solid #dadbdc;
-moz-box-shadow:0 0 5px #cbcbcb;
-webkit-box-shadow:0 0 5px #cbcbcb;
margin:100px auto;
padding:2px;
}

mail,a {
color:#808285;
font-weight:400;
cursor:pointer;
outline-width:medium;
outline-style:none;
outline-color:#-moz-use-text-color;
}

mail,a:hover {
color:#414042;
font-weight:400;
}

</style>
</head>

<body>
	<div id="wrap">
    	<h2>Grazie.</h2>
   	  	<h5>Il messaggio è stato inviato,
    	

    	riceverà una risposta al più presto.</h5>
    	

Clicca qui per ritonare alla home.</p>
	</div>
</body>
</html>

Ora come posso implementare Phpmailer con autenticazione???
Sono abbastanza ignorante a tal proposito e richiedo urgentemente aiuto...

Grazie