Sara_Sa Posted March 7, 2007 Share Posted March 7, 2007 I've AppServ Open Project - 2.4.0 for Windows & PHP Version 4.3.6 But when I use mail() function I see this error : 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:\appserv\www\mail.php on line 33 How can I use ini_set() and send email messages from local server?? ** note: I don't have enough information about mailserver ** Quote Link to comment https://forums.phpfreaks.com/topic/41627-my-problem-with-mail-function/ Share on other sites More sharing options...
redarrow Posted March 7, 2007 Share Posted March 7, 2007 To all you guys out there having problems with mail scripts throwing back this (and you know your scripts are right!!)... Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in: I had started seeing this after moving some scripts from 4.3 servers to 5. a dirty get around is using ini_set ("sendmail_from","a.body@acompany.com"); to force the From header. Not ideal but it works. Quote Link to comment https://forums.phpfreaks.com/topic/41627-my-problem-with-mail-function/#findComment-201693 Share on other sites More sharing options...
Sara_Sa Posted March 7, 2007 Author Share Posted March 7, 2007 redarrow I'm beginner in php language This is my script file: http://download1-2.files-upload.com/2007-03/07/17/mail.rar Please - if you can - make changes and upload it Thanks for your reply Quote Link to comment https://forums.phpfreaks.com/topic/41627-my-problem-with-mail-function/#findComment-201832 Share on other sites More sharing options...
Sara_Sa Posted March 10, 2007 Author Share Posted March 10, 2007 Looking For Help Quote Link to comment https://forums.phpfreaks.com/topic/41627-my-problem-with-mail-function/#findComment-204227 Share on other sites More sharing options...
aniesh82 Posted March 10, 2007 Share Posted March 10, 2007 Hello I tried to download the rar file from the above link. But that page is not available. Regards Aniesh Joseph Quote Link to comment https://forums.phpfreaks.com/topic/41627-my-problem-with-mail-function/#findComment-204267 Share on other sites More sharing options...
legohead6 Posted March 10, 2007 Share Posted March 10, 2007 just copy the code onto the forum, it makes it esier for everyone to help you. Quote Link to comment https://forums.phpfreaks.com/topic/41627-my-problem-with-mail-function/#findComment-204288 Share on other sites More sharing options...
Sara_Sa Posted March 10, 2007 Author Share Posted March 10, 2007 The file in attachments Thank You Aniesh [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/41627-my-problem-with-mail-function/#findComment-204294 Share on other sites More sharing options...
Sara_Sa Posted March 10, 2007 Author Share Posted March 10, 2007 just copy the code onto the forum, it makes it esier for everyone to help you. This is the code: <html> <head><title>Send Email</title></head> <body bgcolor="#EEEEEE"> <center> <form action="mail.php" method="post"> <table cellpadding=2 cellspacing=0 border=0> <tr><td><b>Sender</b></td><td><input type="text" name="you"></td></tr> <tr><td><b>Recipient</b></td><td><input type="text" name="to"></td></tr> <tr><td><b>Title</b></td><td><input type="text" name="tit"></td></tr> <tr><td><b>Message</b></td><td><textarea rows=6 cols=16 name="msg" ></textarea></td></tr> <tr><td> </td><td><input type="submit" value="Send Now"></td></tr> </table> </form> <?php if ($_SERVER["REQUEST_METHOD"]=="POST"){ mail("$to", "$tit", "$msg","From:$you"); } ?> </center> </body> </html> Thank You Quote Link to comment https://forums.phpfreaks.com/topic/41627-my-problem-with-mail-function/#findComment-204298 Share on other sites More sharing options...
per1os Posted March 10, 2007 Share Posted March 10, 2007 Wow first of all it is a bad idea to not declare variable from a form, second of all it is a very bad idea. Try this. <?php if ($_SERVER["REQUEST_METHOD"]=="POST"){ mail($_POST['to'], $_POST['tit'], $_POST['msg'],"From:" . $_POST['you']); } ?> </center> </body> </html> Never refer to POST or GET variable just by their name, always define them or bad stuff can happen. That is why register_globals is turned off by default for security reasons. --FrosT Quote Link to comment https://forums.phpfreaks.com/topic/41627-my-problem-with-mail-function/#findComment-204320 Share on other sites More sharing options...
Sara_Sa Posted March 11, 2007 Author Share Posted March 11, 2007 frost110 My basic problem was in mail() function I can't send email messages from local server When I test that script I see the following error message: Warning: mail(): Failed to connect to mailserver at "localhost" port 25 ..etc ??? But I learned important lesson today >> Never refer to POST or GET variable just by their name, always define them.. << Thank you so much frost110 Quote Link to comment https://forums.phpfreaks.com/topic/41627-my-problem-with-mail-function/#findComment-204585 Share on other sites More sharing options...
Sara_Sa Posted March 12, 2007 Author Share Posted March 12, 2007 I Still Looking For Help Quote Link to comment https://forums.phpfreaks.com/topic/41627-my-problem-with-mail-function/#findComment-205383 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.