IsSMTP(); // telling the class to use SMTP $mail->Host = "smtpout.secureserver.net"; // SMTP server $mail->SMTPDebug = 2; // enables SMTP debug information (for testing) // 1 = errors and messages // 2 = messages only $mail->SMTPAuth = true; // enable SMTP authentication $mail->Host = "smtpout.secureserver.net"; // sets the SMTP server $mail->Port = 25; // set the SMTP port for the GMAIL server $mail->Username = "usr"; // SMTP account username $mail->Password = "password"; // SMTP account password $mail->SetFrom($_POST["from"], 'First Last'); $mail->AddReplyTo($_POST["from"],"First Last"); $mail->AddAttachment("images/phpmailer.gif"); // attachment $mail->Subject = "PHPMailer Test Subject via smtp, basic with authentication"; $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $mail->MsgHTML($_POST["body"]); $address = $_POST["to"]; $mail->AddAddress($address, "John Doe"); if(!$mail->Send()) { die( "Mailer Error: " . $mail->ErrorInfo); } else { echo "Message sent!"; } ?>