 |
 |
PHP mail() help
|
 |
|
 |
|
Grizzled Veteran
Join Date: Aug 2002
Location: Springfield, Oregon
Status:
Offline
|
|
Hello All,
I am trying to create e-mail by using the mail() function in php. I have my machine set up the corret way, and I am serving the file from local host.
After I create the mail.php file (I know that it doesn't have to be called this, I am just doing it for S&G factor), I go to http://localhost/mail.php and I see the expected results but I never recieve the e-mail!
Here is the code that I am using:
<?
$result = mail("rclark2@gladstone.uoregon.edu", "test", "Let me know if this worked man.\nI");
if($result = true)
{
print "It sent!";
}
else
{
print "Nope, try again!";
}
?>
If anyone has any suggestions on developing php on my osx machine, I would greatly apreciate it. My email is above in the "to" parameter...Though I will be looking for ansers here in this form as well.
Thanks guys / gals!
P.S. For some reason, this forum is not allowing the open php tag, so that part is really there on my machine....<?
|
Live Victoriously. Live Virtuously. Hale the Old Gods!
Odin, Thor, Freya, Freyr, Sif, Balder, Frigga, Loki, Ran, Njord, Aegir, Bragi, Forseti, Gefion, Heimdall, Hermod, Hulda, Idhunn, Mimir, Sigyn, Skadi, Tyr, Ull, Nanna.
Hale All!
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status:
Offline
|
|
Have you configured your Mac/PC to use Sendmail properly? It's quite a task, and one that's prone to many late nights and bad coffees...
There's a topic on the Mac OS X discussions (may be a week or two old) that talks about setting up Sendmail on a Mac OS X client box. That's the key to it. Once you've got that set up there's very little else that needs to be configured to get PHP to work with mail().
|
|
Computer thez nohhh...
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Apr 2001
Location: NYF'nC
Status:
Offline
|
|
If ($result = true) is always true because you are assigning the value of true to $result. Try
Code:
if ($result == true) {
or
or even better:
Code:
if (mail(rclark2@gladstone.uoregon.edu", "test", "Let me know if this worked man.\nI")) {
|

Jim Rockford was beaten repeatedly for your entertainment.
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status:
Offline
|
|
Not meaning to hijack but, sendmail is known to be a pain to get going on X< cause every software update changes permissions that sendmail doesn't like. Is there a way to make PHP use a standard SMTP server for email? I have Apple's SMTP server running on my Server and using that, or any other instead, would seem to be alot easier. Back when i used to have a UBB running on a Mac, instead of using sendmail, i choose the windows option and selected SMTP Server, typed the machines own IP, and it worked perfectly.
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status:
Offline
|
|
Originally posted by l008com:
Is there a way to make PHP use a standard SMTP server for email?
Yep, the nice folks at phpclasses.net have written a mail class that allows you to automate the whole process - you add text/html/images and other attachments automatically, specify your recipients and then the SMTP server details and voila!
|
|
Computer thez nohhh...
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status:
Offline
|
|
But what about a way to make all scripts that use mail, like guestbooks and even this vBulletin, use SMTP instead of sendmail? Instead of just writing scripts specifically for them.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|