/    Sign up×
Community /Pin to ProfileBookmark

Trouble sending simple email

im trying to get a simple email send using php

the form for getting the info

[code=html]<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>
[/code]

the php code for processing it

[code=php]<?
$to = $_POST[‘to’];
$re = $_POST[‘from’];
$comments = $_POST[‘comments’];

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

?>[/code]

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

[quote]

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 fileseasyphp1-8wwwnew foldersendmixed.php on line 8

[/quote]

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@bokehApr 06.2007 — That's because you don't have a mailexchanger.
Copy linkTweet thisAlerts:
@Marcus_MaximusauthorApr 06.2007 — the book i have doesn't mention anything about that how do i set one up or is it too much hastle
Copy linkTweet thisAlerts:
@Marcus_MaximusauthorApr 08.2007 — 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 = [email][email protected][/email]

i have outlook set up on my machine
×

Success!

Help @Marcus_Maximus spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...