(no commit message)
[mailer.git] / 0.2.1 / inc / phpmailer / docs / use_gmail.txt
1 <?php\r
2 \r
3 // example on using PHPMailer with GMAIL \r
4 \r
5 include("class.phpmailer.php");\r
6 include("class.smtp.php");\r
7 \r
8 $mail=new PHPMailer();\r
9 \r
10 $mail->IsSMTP();\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
15 \r
16 $mail->Username   = "yourname@gmail.com";  // GMAIL username\r
17 $mail->Password   = "password";            // GMAIL password\r
18 \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
24 \r
25 $mail->WordWrap   = 50; // set word wrap\r
26 \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
31 \r
32 $mail->IsHTML(true); // send as HTML\r
33 \r
34 if(!$mail->Send()) {\r
35   echo "Mailer Error: " . $mail->ErrorInfo;\r
36 } else {\r
37   echo "Message has been sent";\r
38 }\r
39 \r
40 ?>\r