A simple HTML form can be used to pass details to the script to be sent instead of the fixed message used previously.
Important parts to the form are the filename of the script
And the variable that will contain the data from the form
Then in the phpmailer script the variable needs to be collected and put in the body of the sent email. For example replace the previous
<form name="contact" method="post" action="phpmailerscript.php">
<input name="name" type="text" size="45" value="<?php echo $name ?>">
$mail->Body = "hi ! \n\n this is First mailing I made myself with PHPMailer !";
now how do we add an attachment??
$mail->Body = "Name: $name\n";