
January 24th, 2013, 05:57 PM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 4
Time spent in forums: 1 h 8 m 22 sec
Reputation Power: 0
|
|
Thanks a lot DavidMR! Here is the code:
The code
There 3 files total in a folder mlr, put the folder to webserver document root and let the browser point to
http://localhost/mlr/smtp_basic.php
you can then see the result.
On my snow leopard, the error msg is
Code:
Invalid address: developer@advisors-online.comInvalid address: developer@advisors-online.comInvalid address: tster@advisors-online.comMailer Error: You must provide at least one recipient email address.
while on my xp system, it said
Code:
.....
Message sent!
The code of smtp_basic.php is:
Code:
<html>
<head>
<title>PHPMailer - SMTP basic test with authentication</title>
</head>
<body>
<?php
//error_reporting(E_ALL);
error_reporting(E_STRICT);
date_default_timezone_set('America/Denver');
require_once('class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "elinkage.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 = "advisors-online.com"; // sets the SMTP server
$mail->Port = 25; // set the SMTP port for the GMAIL server
$mail->Username = "developer@advisors-online.com"; // SMTP account username
$mail->Password = "caicaikan"; // SMTP account password
$mail->ContentType = 'fext/plain';
$mail->IsHTML(false);
$mail->SetFrom('developer@advisors-online.com', 'Developer ADV');
$mail->AddReplyTo('developer@advisors-online.com', 'Developer ADV');
$mail->Subject = "PHPMailer Test Subject via smtp, basic with authentication";
$mail->Body = "Testing msg....\nPlease ignore.........";
$address = "tster@advisors-online.com";
$mail->AddAddress($address, "Tester ADV");
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
</body>
</html>
|