[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 153
  • Last Modified:

PHP Mail from Windows

I am new to PHP and I have an Apache server running on a Windows XP box hosting a small group forum with authentication. The website package I am using has the ability to send mail but I am assuming that this was written for a unix box. All this needs to do is send a email that says "Yes you are signed up". All the help i have seen on their site is for SendMail. Which i have come to learn is a Unix thing. I also need to send it through a google account which means i need to designate the port and password and such. I came across mention of using PHPMailer. But despite my best intentions I can't make sense of their install directions. I am used to just unzipping a package and adjusting a config file.. and things work.. what am i missing. Can someone help me with a step by step install instructions? With google would be even more of a bonus!
0
datagears
Asked:
datagears
1 Solution
 
kamermansCommented:
Hi, you just need to put class.phpmailer.php and class.smtp.php in the directory with your mailer script - I'll call this script sendit.php:

sendit.php
-----------------------------------------------
<?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.gmail.com"; // your SMTP server (this should be your LOCAL mail server from your ISP - it doesn't have to be gmail.com [ie. smtp.comcast.com])
$mail->From = "from@gmail.com"; // your address
$mail->AddAddress("myfriend@site.com"); // your recipient

$mail->Subject = "first mailing";
$mail->Body = "hi ! \n\n this is First mailing I made myself with PHPMailer !";
$mail->WordWrap = 50;

if(!$mail->Send())
{
   echo "Message was not sent";
   echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
   echo "Message has been sent";
}
?>  
-----------------------------------------------------------------------------
There is no config file for PHPMailer - you just need to copy the class files to a dir that you can access, then 'require()' those files
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now