How to test sendmail on local machine?

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
sabas
Forum Newbie
Posts: 4
Joined: Mon Mar 01, 2004 2:40 am

How to test sendmail on local machine?

Post by sabas »

<HTML>
<HEAD><TITLE>E-mail</TITLE>

<FORM METHOD=POST ACTION="sendmail.php">

<TABLE>
<TR>
<TD>E-mail:</TD>
<TD> <INPUT TYPE="text" NAME="email" size="25" /></TD>
</TR>
<TR>
<TD valign=top>Message:</TD>
<TD> <TEXTAREA NAME="message" ROWS="15" COLS="40"></TEXTAREA> <p></TD>
</TR>
<TR>
<TD colspan="2" align=center><INPUT name="submit" TYPE="submit" value="Submit"></TD>
</TR>
</TABLE>

</FORM>

</HEAD>
</HTML>

----------------

sendmail.php:

<?php
$email = $_REQUEST['email'];
$message = $_REQUEST['message'];

mail("myemail@yahoo.com","FeedBackt", $message, "From: $email");
header("Location: thankyou.html");
?>


I got a "Save As" dialog when I hit the button Submit. That's weird! could anybody tell me why thankyou.html has not come up?

(I put both of them in the folder C:\AppSer\apache\htdocs)
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Do you have php installed ?

make a page with this code .

Code: Select all

<?
phpinfo();
?>
save it as test.php and run it..

http://localhost/test.php
sabas
Forum Newbie
Posts: 4
Joined: Mon Mar 01, 2004 2:40 am

Post by sabas »

I already installed php and I also got phpinfo.php (or test.php as you called) that works fine. So ?
maldar
Forum Commoner
Posts: 49
Joined: Mon Aug 18, 2003 4:39 pm

Post by maldar »

You can not test sendmail functionality on localhost and you need a real host .
but if you want send mail from localhost , it is possible.
for more info take a look at this :
viewtopic.php?t=12462&highlight=
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Post by Steveo31 »

sabas
Forum Newbie
Posts: 4
Joined: Mon Mar 01, 2004 2:40 am

How to test sendmail on local machine?

Post by sabas »

Thanks very much,
Post Reply