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
HTML FORM
HTML Code:
<form name="contact" method="post" action="phpmailerscript.php">
<input name="name" type="text" size="45" value="<?php echo $name ?>">
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
PHP Code:
$mail->Body = "hi ! \n\n this is First mailing I made myself with PHPMailer !";
with
PHP Code:
$mail->Body = "Name: $name\n";
now how do we add an attachment??
Bookmarks