Send Email

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
Parody
Forum Contributor
Posts: 252
Joined: Fri May 06, 2005 7:06 pm
Location: Great Britain

Send Email

Post by Parody »

Code: Select all

$to = '".$email."';
$subject = "Homies For Life Password!";
$body = "Your password is : '".$rand."'";
if (mail($to, $subject, $body))
{
   echo("<p>Your password has been sent to the email address:'".$email."' </p>");
}
else
{
   die("<p>The email containing your password failed to send, please contact an Administator</p>");
}
Ok, that is my script, it works, I think, so I set it to send to my own email address, that was about 10 mins ago, I ran the script and it said it had sent, but.... I have not yet recieved the email. So my question is:
do I need to change any settings or install anything to send email via php on a localhost?
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

E-mail doesn't guarantee instant delivery... So it might take a while...
Parody
Forum Contributor
Posts: 252
Joined: Fri May 06, 2005 7:06 pm
Location: Great Britain

Post by Parody »

How long?
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

More or less as long as a chestnut takes to fall off a barstool. ;)
Parody
Forum Contributor
Posts: 252
Joined: Fri May 06, 2005 7:06 pm
Location: Great Britain

Post by Parody »

So, it depends on the speed you hit it, this baseball bat should make quick work of my server :evil: :evil:
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

No. The chestnut just sits on the barstool. It might fall, it might not. Time will tell ;)

And no, you don't need to configure anything for PHP's mail() function to work.
Parody
Forum Contributor
Posts: 252
Joined: Fri May 06, 2005 7:06 pm
Location: Great Britain

Post by Parody »

I wanna hit the chestnut! :P
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

That's where you go wrong. Chestnuts fall only from trees, not usually from barstools ;)
Parody
Forum Contributor
Posts: 252
Joined: Fri May 06, 2005 7:06 pm
Location: Great Britain

Post by Parody »

Ok, i'm gonna hit all the chestnuts, off the trees and off the barstools, and wherever else they hang their hats! I'm gonna kill em all!!!!!!!!!!!!!!! :!: :!: :!:
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

btw. check you PMs, please.
Parody
Forum Contributor
Posts: 252
Joined: Fri May 06, 2005 7:06 pm
Location: Great Britain

Post by Parody »

Is that better?
Post Reply