FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Code Stops Working
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Code Stops Working [message #172388 is a reply to message #172385] Wed, 16 February 2011 01:40 Go to previous messageGo to previous message
P E Schoen is currently offline  P E Schoen
Messages: 86
Registered: January 2011
Karma:
Member
"Mike Copeland" wrote in message
news:MPG(dot)27c4ca15863d82319896a6(at)news(dot)eternal-september(dot)org...

> $eml_result = email($to,
> $subject, $from, $body1);

I'm not a PHP expert, but it seems that you have the $from and $body1
reversed.

The correct syntax is:

$to = "someone(at)example(dot)com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "someonelse(at)example(dot)com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);

Also, the server may have some requirements for the sender ($from). This is
an example from my sendmail.ini for my xampp Apache server for Localhost:

# Set default values for all following accounts.
defaults
logfile "C:\xampp\sendmail\sendmail.log"

# Mercury
account Mercury
host localhost
from postmaster@localhost
auth off

# Set a default account
account default : Mercury

You might need to do something else for a remote server. This might help:
http://email.about.com/od/emailprogrammingtips/qt/Configure_PHP_to_Use_a_Lo cal_Mail_Server_for_Sending_Mail.htm

Paul
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: about memory usage with php application
Next Topic: PHP currency converter with XML feed
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 23:26:46 GMT 2024

Total time taken to generate the page: 0.04297 seconds