Page 1 of 1
checking a function (mail)
Posted: Tue Feb 08, 2005 9:54 am
by godonholiday
what line of the config table do i look at after i have run phpini()
i am trying to find out if the mail function can be used.
any help would be great
thanks in advance
g
Posted: Tue Feb 08, 2005 10:01 am
by anjanesh
phpini() ?
phpinfo()
Internal Sendmail Support for .....enabled
Posted: Tue Feb 08, 2005 10:02 am
by feyd
http://php.net/mail
that hard to look at the docs?
hotmail accounts
Posted: Tue Feb 08, 2005 10:22 am
by godonholiday
is it possibel to use a php form to send the form information as an email to a hotmail or yahoo account?
thanks for the help
Posted: Tue Feb 08, 2005 10:23 am
by feyd
why wouldn't it?
not sure?
Posted: Tue Feb 08, 2005 10:28 am
by godonholiday
so should't this code work?
thanks again
Code: Select all
<?php
$john = "12345";
mail("info@hotmail.com","This is for john","send an email to Gavin on someaddress@hotmail.com when you get this");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
Hello <?php echo $john ?> IF YOU GET THIS EMAIL PLEASE SEND AN EMAIL TO GAVIN ON some address@hotmail.com
</body>
</html>
Posted: Tue Feb 08, 2005 10:31 am
by feyd
provided mail is properly configured, it should work. Please use
sorry
Posted: Tue Feb 08, 2005 10:33 am
by godonholiday
jumped the gun a little and have just read the before you post file.
do i have to configure hotmail?? because right now nothing is happening? it displays the hello message and reads the php variable??
hmm im desprate to get this working.
thanks
Posted: Tue Feb 08, 2005 10:36 am
by feyd
no, not hotmail.. your php's mail function needs to be properly configured. Read the documentation I linked to originally.. it explains what configuration variables pertain to mail() and details what you need to do, on a Windows machine to get the to work.. if that's your server architecture.
oh
Posted: Tue Feb 08, 2005 10:40 am
by godonholiday
ahh so i have to congig the ini file on the server and the machine im developing on.
ill give it a go, but will prob be back in an hour or two.
thanks for your help
g
this is what i have now
Posted: Tue Feb 08, 2005 1:34 pm
by godonholiday
Is there any way that you can test this please. I dont know how to change any of the other config settings, you can check out the config at
http://appsform.pwp.blueyonder.co.uk/test.php
cheers for your help
Code: Select all
<?php
$john = "12345";
ini_set(sendmail_from, "form@formsite.co.uk");
/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
/* additional headers */
$headers .= "To: example@yahoo.com\r\n";
$headers .= "From: form@formsite.co.uk\r\n";
/* and now mail it */
mail("example@yahoo.com.com", "this is the subject", "this is the body", "$headers");
ini_restore(sendmail_from);
phpinfo();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
Hello <?php echo $john ?><br>
<?php echo $headers ?>
</body>
</html>