Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SMTP send email with Gmail 1

Status
Not open for further replies.

rca63

Programmer
Jun 26, 2011
12
HK
thread434-1521422

May I ask your help, my notebook computer as server with XP window, do I need other software to send email, by setting
the php.ini smtp=local host smtp port = 25. After running pgm,
I have the follwing
SMTP Error: Could not connect to SMTP host. Mailer Error: SMTP Error: Could not connect to SMTP host.

Here is my program . . .
<?php
include("phpmailer/class.phpmailer.php");
$mail = new PHPMailer();
$mail->Host = "ssl://smtp.gmail.com::465";
$mail->SMTPSecure = "ssl";
$mail->IsSMTP(); // send via SMTP

//IsSMTP(); // send via SMTP
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "c238@gmail.com"; // SMTP username
$mail->Password = "my_password"; // SMTP password
$webmaster_email = "c238@gmail.com"; //Reply to this email ID
$email="c238@gmail.com"; // Recipients email ID
$name="name"; // Recipient's name
$mail->From = $webmaster_email;
$mail->FromName = "Webmaster";
$mail->AddAddress($email,$name);
$mail->AddReplyTo($webmaster_email,"Webmaster");
$mail->WordWrap = 50; // set word wrap
//$mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // attachment
$mail->IsHTML(true); // send as HTML
$mail->Subject = "This is the subject";
$mail->Body = "Hi,
This is the HTML BODY "; //HTML Body
$mail->AltBody = "This is the body when user views in plain text format"; //Text Body
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message has been sent";
}
?>

 
Unless you are signing certificates there is no need to install OpenSSL binaries. I do not think you have read the php manual carefully enough.

You need to work out which php instance you are using. Whether it is via appserv (whatever that is) or native php. Since I have no idea what appserv is I can boy recommend doing the normal thing and installing apache mysql and php separately and manually (ie not using the automated installers) . I have never had any problems that route.

The only gotcha for windows is ensuring that certain dlls are available in the windows path environment variable. The link for this is
Essentially you can either edit the path variable or just copy the dll to windows/system32. The former is better from a tidiness perspective.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top