Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I mail() something?

Status
Not open for further replies.

capitano

Programmer
Jul 30, 2001
88
US
I'm having trouble getting mail() to work.
I'm on a Win98 platform running PHP4.06.
when I try to send mail, I'm doing this:

$mailto = "you@foo.com";
$from = "me@foo.com";
$subject = "Any subject";
$body = "Dear Mr. Somebody, Thanks for that thing....";

mail($mailto, $subject, $body, $from)
or die("Could not send mail");

And I get this message in the browser:

Warning: Server Error in C:\Inetpub\webpub\php\email.php
Could not send mail

Please help...

Thanks,
Bryan
 
Okay, I'll respond to me own message for the benefit of the community:

There was nothing wrong with my code. You must ensure your php.ini file is pointing to the correct SMTP server. Since I'm running on Win98 without a mail server (or SMTP), I had to change the php.ini file's default SMTP server:

there is a line in php.ini:
SMTP =

You can set this so
SMTP = mail.your-isp.com

or whatever the mail (SMTP) server name is. Fortunately, I could point to my ISP.

finis!

Bryan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top