Click to See Complete Forum and Search --> : Trouble sending simple email


Marcus Maximus
04-06-2007, 02:17 PM
im trying to get a simple email send using php

the form for getting the info
<html>
<head><title>send mail</title></head>

<body>
<form method="POST" enctype="multipart/form-data" action="sendmixed.php">
<table>
<tr><td>To: </td>
<td><input type="text" name="to" size="40"></td>
</tr>
<tr>
<td>From: </td>
<td><input type="text" name="from" size="40"></td>
</tr>
<tr>
<td>Message:</td>
<td><textarea rows="5" name="comments" cols="33"></textarea></td>
</tr>
<tr><td colspan = "2"><input type="submit" value="send" name="send"></td></tr>
</table>
</form>
</body>
</html>


the php code for processing it
<?
$to = $_POST['to'];
$re = $_POST['from'];
$comments = $_POST['comments'];

$msg = $comments;
#send mail
$ok = mail($to, $re, $msg);
if($ok) echo "OK"

?>

gives me this error and i don't know what its telling me exactly

Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in c:\program files\easyphp1-8\www\new folder\sendmixed.php on line 8

bokeh
04-06-2007, 02:45 PM
That's because you don't have a mailexchanger.

Marcus Maximus
04-06-2007, 02:52 PM
the book i have doesn't mention anything about that how do i set one up or is it too much hastle

Marcus Maximus
04-08-2007, 01:50 PM
i've reading up a bit more on it but im not quite sure what to do

can i set up in the php.ini file to use my hotmail or gmail account

for example can i set it up in php.ini like this
[mail function]
; For Win32 only.
SMTP = mail.hotmail.com
smtp_port = 25

; For Win32 only.
sendmail_from = me@hotmail.com

i have outlook set up on my machine