0

I'm able to send email on a linux server using PHPmailer https://github.com/Synchro/PHPMailer without putting my email address, password or host address like from the PhpMailer website. I was wondering if I can do it on my windows local machine since I would prefer to do testing on my local machine. Right now, I always upload to the linux server to test my code. Is there anyway to maintain my code and send email through my local windows machine? Do I have to install like a mail server or something? Please recommend. Thanks.

Below is part of my php code for sending email. Unlike the example given from the PhpMailer website, I don't have to include my email add or password.

$mailbody = "<p>Testing email send</p>";
//Create a new PHPMailer instance
$mail = new PHPMailer();

$mail->setFrom('nodeffect@gmail.com', 'nodeffect');

$mail->addReplyTo('nodeffect@gmail.com', 'nodeffect');

$mail->addAddress(example@yahoo.com, Somename);

$mail->Subject = 'Email Testing';

$mail->msgHTML($mailbody);

$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
nodeffect
  • 1,830
  • 5
  • 25
  • 42
  • 1
    you should install a smtp server if you wanna send mail from your localhost – epipav Jul 23 '14 at 08:51
  • 1
    Please don't use the PHPMailer version from my personal fork - use the official repo at https://github.com/PHPMailer/PHPMailer – Synchro Jul 23 '14 at 09:45
  • You only need to provide a password if you are connecting to an SMTP server that requires authentication. If you're using mail or sendmail methods, you don't need them. Windows doesn't usually have a local mail server so you need to either install one, or use a remote server. – Synchro Jul 23 '14 at 09:47

1 Answers1

1

You could use a local SMTP server / Mail Transfer Agent, as mentioned by epipav. Alternatively, specify any existing SMTP server in the mail section of your php.ini, which will then be used by PHP's sendmail implementation.

Also, see: MTA for windows to use for PHP Sendmail

Community
  • 1
  • 1
jossif
  • 399
  • 2
  • 10