PHP email form testing

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tomE
Forum Newbie
Posts: 19
Joined: Tue Jul 12, 2005 7:26 am
Location: Liverpool

PHP email form testing

Post 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.
choppsta
Forum Contributor
Posts: 114
Joined: Thu Jul 03, 2003 11:11 am

Post 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.
tomE
Forum Newbie
Posts: 19
Joined: Tue Jul 12, 2005 7:26 am
Location: Liverpool

Post 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.
choppsta
Forum Contributor
Posts: 114
Joined: Thu Jul 03, 2003 11:11 am

Post 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.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

What bearing does having a local SMTP server installed have on the fact the mail wasn't submitted to Yahoo?
tomE
Forum Newbie
Posts: 19
Joined: Tue Jul 12, 2005 7:26 am
Location: Liverpool

Post 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
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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 ;)
Last edited by Chris Corbyn on Tue Jul 19, 2005 9:56 am, edited 1 time in total.
choppsta
Forum Contributor
Posts: 114
Joined: Thu Jul 03, 2003 11:11 am

Post 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?!?!!
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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 ;)
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Well, that's provided that your ISP allows outgoing SMTP connections (I know mine doesn't).
tomE
Forum Newbie
Posts: 19
Joined: Tue Jul 12, 2005 7:26 am
Location: Liverpool

Post 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.
Post Reply