Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,468 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,424 people online right now. Registration is fast and FREE... Join Now!




Email

 
Reply to this topicStart new topic

Email, Email Problem?

devinv
post 18 Mar, 2005 - 03:12 AM
Post #1


New D.I.C Head

*
Joined: 18 Mar, 2005
Posts: 1

Hi

I am having problems sending this email using a very basic form. I have configured the php.ini file to reflect the correct smtp server but I keep getting a error in line 9 of my .php script? Am I missing a header?

Please can somebody double check my script & configuration data to see if there are any errors.

Thanks



*php.ini

[mail function]
; For Win32 only.
SMTP = 127.26.1.2
smtp_port = 25

; For Win32 only.
sendmail_from = enquiries@midastelecom.ws



*Error Log>


[Fri Mar 18 08:32:11 2005] [error] PHP Warning: mail() [<a href='function.mail'>function.mail</a>]: &quot;sendmail_from&quot; not set in php.ini or custom &quot;From:&quot; header missing in c:\\Apache\\htdocs\\feedback.php on line 9



*.html>



<html>
<head> <title>Feedback Form</title> </head>
<body>
<form action="feedback.php" method="post">
Name:<input type="text" name="username" size="30">
<br> <br>
Email:<input type="text" name="useraddr" size="30">
<br> <br>
<textarea name="comments" cols="30" rows="5">
</textarea><br>
<input type="submit" value="Send Form">
</form>
</body>
</html>


*.php>



<?php
$username = $_POST['username'];
$useraddr = $_POST['useraddr'];
$comments = $_POST['comments'];

$to = "enquiries@midastelecom.ws";
$re = "Website Feedback";
$msg = $comments;
mail( $to, $re, $msg );
?>

<html>
<head><title>Message Received</title></head>
<body>
<h1>Thanks for your comments</h1>
Message received from <?php echo( $username ); ?>
<br>
Reply to <?php echo( $useraddr ); ?>
</body>
</html>
User is offlineProfile CardPM

Go to the top of the page

Amadeus
post 18 Mar, 2005 - 06:14 AM
Post #2


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 12,173



Thanked 33 times

Dream Kudos: 25
My Contributions


Have you set all the required settings in the ini file for the mail() function? Looks like it still has problems with the sendmail_from setting.
User is offlineProfile CardPM

Go to the top of the page

SpaceMan
post 18 Mar, 2005 - 07:07 PM
Post #3


D.I.C Regular

Group Icon
Joined: 20 Feb, 2003
Posts: 270

might try

$username = $_POST['username'];
$useraddr = $_POST['useraddr'];
$comments = $_POST['comments'];

$to = "enquiries@midastelecom.ws";
$re = "Website Feedback";
$msg = "user:\n$username\nemail:\n$useraddr\ncomments\n$comments";

mail( $to, $re, $msg, "From:$useraddr");
or
mail( $to, $re, $msg, $to);

[edit]i spell good, NOT[/edit]

This post has been edited by SpaceMan: 18 Mar, 2005 - 07:12 PM
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/22/08 01:50PM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month