Page 1 of 1

PHP email form testing

Posted: Tue Jul 19, 2005 7:10 am
by tomE
Is it possible to set up some kind of local smtp test server?

I have IIS 5.1 and PHP 4.3.4 setup and running fine. I also have made some test scripts of email submission forms with the PHP scripts running locally on my IIS server they work fine but when i test them out there is no email submitted to my yahoo account.

Posted: Tue Jul 19, 2005 7:53 am
by choppsta
For local testing there's a nice package called XAMPP (http://www.apachefriends.org) which has everything you need. It includes something called Mercury Mail Transport System that you could try.

Alternatively, you could use phpMailer (http://phpmailer.sourceforge.net) and then specify an external SMTP server such as your ISP's.

Posted: Tue Jul 19, 2005 8:18 am
by tomE
Xampp is an apache package, i need to use the windows IIS server.

How do i setup an external smtp server? Would that leave me vulnerable to attack? This application is for local testing only.

Posted: Tue Jul 19, 2005 8:38 am
by choppsta
Mercury Mail Transport System is available seperately:
http://www.pmail.com/overviews/ovw_mercury.htm

I've never used it myself, but know other people have used it and say it's quite simple to set up.

The benefit of using an external SMTP server would be that you WOULDN'T have to set up anything. You'd just be using the same SMTP server you use to send your regular email.

If your ISP provides you with access to their SMTP server you could try that.

Posted: Tue Jul 19, 2005 8:57 am
by Chris Corbyn
What bearing does having a local SMTP server installed have on the fact the mail wasn't submitted to Yahoo?

Posted: Tue Jul 19, 2005 9:48 am
by tomE
I don't know but i thought there would be an easier way than this to setup IIS to test my email form submission scripts.

Has anyone set up a system similar to this? If so what/how did you do (with)?

Thanks for the help guys

Posted: Tue Jul 19, 2005 9:55 am
by Chris Corbyn
Well I used MailTraq on Win32...

http://www.mailtraq.com/246/

It'll do IMAP and SMTP and NNTP and POP3 ;)

MDaemon is also just about the standard.

EDIT | The email njot reaching Yahoo will be a Junk mail filter issue ;)

Posted: Tue Jul 19, 2005 9:56 am
by choppsta
Using phpMailer you'd just do something like the following:

Code: Select all

require("class.phpmailer.php");

$mail = new PHPMailer();

$mail->IsSMTP();                   // set mailer to use SMTP
$mail->Host = "smtp.example.com";  // specify server
$mail->SMTPAuth = true;		   // turn on SMTP authentication
$mail->Username = "username";      // SMTP username
$mail->Password = "secret";        // SMTP password

$mail->From = "from@example.com";
$mail->AddAddress("to@example.com");

$mail->Subject = "Here is the subject";
$mail->Body    = "This is the message body";

$mail->Send();
I'm not sure how much simpler you can you get?!?!!

Posted: Tue Jul 19, 2005 9:59 am
by Chris Corbyn
choppsta wrote: I'm not sure how much simpler you can you get?!?!!
I think she/he needs the software to run the server on localhost... not a sscript ;)

Posted: Tue Jul 19, 2005 2:56 pm
by Ambush Commander
Well, that's provided that your ISP allows outgoing SMTP connections (I know mine doesn't).

Posted: Tue Jul 19, 2005 5:11 pm
by tomE
Its true he does need to keep it on localhost server well spotted d11.

If my ISP, which i think it does, allows me to make outgoing SMTP connections how would i set it up? Is is just a case of changing my preferences in IIS or do I have to reconfigure(?) the php.ini file?

I just re read my original post and i think i was a little unclear about what i need to do. So...

Just to clarify, as i am a begninner, I have setup IIS and PHP. Ran the PHPtest script to check it was working, fine. I then made an email submission form with PHP and HTML, setting the mail address to my yahoo account so i could create a form in my website and test it out before uploading it all. When i sent the email the script ran without errors but i did not recieve the email. So... I think i have this right. Using PHPMailer, MDaemon or Mailtraq i can achieve this with a basic knowledge of PHP, IIS and SMTP.