1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <html>
- <head>
- <title>PHPMailer - SMTP (Gmail) basic test</title>
- </head>
- <body>
- <?php
- error_reporting(E_STRICT);
- date_default_timezone_set('America/Toronto');
- require_once('../class.phpmailer.php');
- $mail = new PHPMailer();
- $body = file_get_contents('contents.html');
- $body = eregi_replace("[\]",'',$body);
- $mail->IsSMTP();
- $mail->Host = "mail.yourdomain.com";
- $mail->SMTPDebug = 2;
-
-
- $mail->SMTPAuth = true;
- $mail->SMTPSecure = "ssl";
- $mail->Host = "smtp.gmail.com";
- $mail->Port = 465;
- $mail->Username = "yourusername@gmail.com";
- $mail->Password = "yourpassword";
- $mail->SetFrom('name@yourdomain.com', 'First Last');
- $mail->AddReplyTo("name@yourdomain.com","First Last");
- $mail->Subject = "PHPMailer Test Subject via smtp (Gmail), basic";
- $mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
- $mail->MsgHTML($body);
- $address = "whoto@otherdomain.com";
- $mail->AddAddress($address, "John Doe");
- $mail->AddAttachment("images/phpmailer.gif");
- $mail->AddAttachment("images/phpmailer_mini.gif");
- if(!$mail->Send()) {
- echo "Mailer Error: " . $mail->ErrorInfo;
- } else {
- echo "Message sent!";
- }
- ?>
- </body>
- </html>
|