Jump to content

Recommended Posts

Posted

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

Posted

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

Posted (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 by karldenton
Posted

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

Posted

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" );

Posted

Something like:

 

$body = <<<_MSG_
This is a message from {$name} in room {$room}.

Message:

{$message}
_MSG_;

mail( "***", "Message from Intranet", $body, "From: $name ");

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...