Add analytics
[bus.git] / busui / owa / includes / PHPMailer_v2.0.3 / docs / use_gmail.txt
maxious 1 <?php
2
3 // example on using PHPMailer with GMAIL
4
5 include("class.phpmailer.php");
6 include("class.smtp.php"); // note, this is optional - gets called from main class if not already loaded
7
8 $mail = new PHPMailer();
9
10 $body = $mail->getFile('contents.html');
11 $body = eregi_replace("[\]",'',$body);
12
13 $mail->IsSMTP();
14 $mail->SMTPAuth = true; // enable SMTP authentication
15 $mail->SMTPSecure = "ssl"; // sets the prefix to the servier
16 $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
17 $mail->Port = 465; // set the SMTP port
18
19 $mail->Username = "yourname@gmail.com"; // GMAIL username
20 $mail->Password = "password"; // GMAIL password
21
22 $mail->From = "replyto@yourdomain.com";
23 $mail->FromName = "Webmaster";
24 $mail->Subject = "This is the subject";
25 $mail->AltBody = "This is the body when user views in plain text format"; //Text Body
26 $mail->WordWrap = 50; // set word wrap
27
28 $mail->MsgHTML($body);
29
30 $mail->AddReplyTo("replyto@yourdomain.com","Webmaster");
31
32 $mail->AddAttachment("/path/to/file.zip"); // attachment
33 $mail->AddAttachment("/path/to/image.jpg", "new.jpg"); // attachment
34
35 $mail->AddAddress("username@domain.com","First Last");
36
37 $mail->IsHTML(true); // send as HTML
38
39 if(!$mail->Send()) {
40 echo "Mailer Error: " . $mail->ErrorInfo;
41 } else {
42 echo "Message has been sent";
43 }
44
45 ?>
46