checking a function (mail)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
godonholiday
Forum Newbie
Posts: 7
Joined: Mon Feb 07, 2005 3:12 pm
Location: liverpool

checking a function (mail)

Post 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
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

phpini() ?
phpinfo()
Internal Sendmail Support for .....enabled
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

http://php.net/mail

that hard to look at the docs?
godonholiday
Forum Newbie
Posts: 7
Joined: Mon Feb 07, 2005 3:12 pm
Location: liverpool

hotmail accounts

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

why wouldn't it?
godonholiday
Forum Newbie
Posts: 7
Joined: Mon Feb 07, 2005 3:12 pm
Location: liverpool

not sure?

Post 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>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

provided mail is properly configured, it should work. Please use

Code: Select all

/

Code: Select all

tags.
godonholiday
Forum Newbie
Posts: 7
Joined: Mon Feb 07, 2005 3:12 pm
Location: liverpool

sorry

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
godonholiday
Forum Newbie
Posts: 7
Joined: Mon Feb 07, 2005 3:12 pm
Location: liverpool

oh

Post 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
godonholiday
Forum Newbie
Posts: 7
Joined: Mon Feb 07, 2005 3:12 pm
Location: liverpool

this is what i have now

Post 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>
Post Reply