IsSMTP(); $mail->SMTPAuth = true; $mail->SMTPSecure = 'tls'; $mail->Host = "smtp.gmail.com"; $mail->Port = 587; $mail->IsHTML(true); $mail->Username = "username@gmail.com"; $mail->Password = "password"; $mail->SetFrom("from@gmail.com"); $mail->AddAddress(htmlentities($_GET['val1'])); $variable['one'] = 'my variable one'; $variable['two'] = 'my variable two'; $mail->IsHTML(true); $mail->Subject = (htmlentities($_GET['val2'])); $mail->Body = get_include_contents('sample.php', $variable); $mail->Send(); if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message has been sent"; } ?>