karldenton Posted May 14, 2009 Posted May 14, 2009 Just done a php script. User types in the details and when presses send - sends an email to me. It gets to the end of the script but the email never arrives? Code below: <?php $name = $_REQUEST['name'] ; $room = $_REQUEST['room'] ; $message = $_REQUEST['message'] ; mail( "[email protected]", "Message from Intranet", $message, "From: $name" ); header( "Location: http://2003server:84" ); ?> Thanks
CESIL Posted May 14, 2009 Posted May 14, 2009 What platform are you running this on? The mail() function will send email via the server specified in php.ini On a *nix box this usually set to go via sendmail On a windows server you need to configure SMTP (I think). I host my sites on Linux but develop on a WAMP setup so I can only test email on the live server, until I can figure out how to get email to work on windows
karldenton Posted May 14, 2009 Author Posted May 14, 2009 (edited) Running on Vanilla Win 2003 server with WAMP installed. Thanks for pointing in line of php.ini Changed to this but still the same: [mail function] ; For Win32 only. SMTP = smtp.redstone4schools.co.uk smtp_port = 25 ; For Win32 only. sendmail_from = [email protected] Edited May 15, 2009 by karldenton
matt40k Posted May 14, 2009 Posted May 14, 2009 Your mail servers would reject it as it's not authenticated. At a guess.
karldenton Posted May 14, 2009 Author Posted May 14, 2009 Possibly, but I use the above settings on printers to email me and they work fine. The mail servers are external
contink Posted May 14, 2009 Posted May 14, 2009 I'd obfuscate your email in that example if I were you... spiders and spammers will grab it in a flash.
karldenton Posted May 15, 2009 Author Posted May 15, 2009 OK, got it working by installing smtp on the server - can't be doing with the isp one ! On the php code <?php $name = $_REQUEST['name'] ; $room = $_REQUEST['room'] ; $message = $_REQUEST['message'] ; mail( "i***@bos*****.org.uk", "Message from Intranet", $message, "From: $name"); header( "Location: http://***:**" ); ?> At the momen I get the email. The subject is "Messge from intranet" and the From is the name someone puts in in the form. How do I get the room and message showing in the message part of the email? Thanks
karldenton Posted May 15, 2009 Author Posted May 15, 2009 Got much further. Got the message coming in now. How do it structure the message into English in the body section mail( "***", "Message from Intranet", "This is a message from" $name "in room" $room $message, "From: $name"); header( "Location: http://***:84" );
powdarrmonkey Posted May 15, 2009 Posted May 15, 2009 Something like: $body = <<<_MSG_ This is a message from {$name} in room {$room}. Message: {$message} _MSG_; mail( "***", "Message from Intranet", $body, "From: $name ");
mossj Posted May 15, 2009 Posted May 15, 2009 Have a look at PHP Tutorial for help on php in particular http://www.w3schools.com/php/php_mail.asp http://www.w3schools.com/php/php_variables.asp http://www.w3schools.com/php/php_forms.asp
karldenton Posted May 15, 2009 Author Posted May 15, 2009 Thanks. Managed to sort it. did the concatinate thing
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now