phpmailer How To Use – Super Easy in 6 minutes!
Here I quickly get you up and running using the phpmailer code so you can start sending emails from your localhost. Everything you need is at website: github. You will also need your smtp port number and the smtp server name from your email system.
If you want to pass a variable from a form that is just as easy. Set up your form as usual. On the page you setup for passing the variable, do something like: $user_email =$_POST[’email’];
Then use the variable $user_email instead of putting an actual email address for the recipient. It’s that simple!
source