3 // example on using PHPMailer with GMAIL
\r
5 include("class.phpmailer.php");
\r
6 include("class.smtp.php");
\r
8 $mail=new PHPMailer();
\r
11 $mail->SMTPAuth = true; // enable SMTP authentication
\r
12 $mail->SMTPSecure = "ssl"; // sets the prefix to the servier
\r
13 $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
\r
14 $mail->Port = 465; // set the SMTP port
\r
16 $mail->Username = "yourname@gmail.com"; // GMAIL username
\r
17 $mail->Password = "password"; // GMAIL password
\r
19 $mail->From = "replyto@yourdomain.com";
\r
20 $mail->FromName = "Webmaster";
\r
21 $mail->Subject = "This is the subject";
\r
22 $mail->Body = "Hi,<br>This is the HTML BODY<br>"; //HTML Body
\r
23 $mail->AltBody = "This is the body when user views in plain text format"; //Text Body
\r
25 $mail->WordWrap = 50; // set word wrap
\r
27 $mail->AddAddress("username@domain.com","First Last");
\r
28 $mail->AddReplyTo("replyto@yourdomain.com","Webmaster");
\r
29 $mail->AddAttachment("/path/to/file.zip"); // attachment
\r
30 $mail->AddAttachment("/path/to/image.jpg", "new.jpg"); // attachment
\r
32 $mail->IsHTML(true); // send as HTML
\r
34 if(!$mail->Send()) {
\r
35 echo "Mailer Error: " . $mail->ErrorInfo;
\r
37 echo "Message has been sent";
\r