General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old January 23rd, 2003, 05:48 PM
Quantum Quantum is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Canada
Posts: 15 Quantum User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Angry Mail() not working

I am trying to use the mail() function to send an email in PHP.
I have altered the php.ini file to include the [mail function] with the parameter ;sendmail_path="(mypath)". The site is being hosted on a Linux server.

When I test the script I receive this error message:
Fatal error: Call to undefined function: ()
in quote_send.php on line 295

Here is the code I am using:
<?PHP
$mail_to = "me@myurl.com";
$mail_subject = "Quote Request";
$mail_body = "Here is a request for a quote:\n";
$mail_body .= "Name: " .$firstname . " " . $lastname . "\n";
$mail_body .= "Company Name: " .$company . "\n";
$mail_body .= "Email Address: " .$email . "\n";
$mail_body .= "Telephone Number: " .$telephone . "\n";
$mail_body .= "Job Title: " .$title . "\n";
$mail_body .= "Service Selected: " . $service . "\n";
$mail_body .= "Project Requirements: " . $requirements . "\n";
$mail_body .= "How you Heard about Us: " . $C . " " . $P . " " . $O . " " . $W . " " . $WS . " " . $S . " " . $OT . "\n";

/*this is line 295*/ if ($mail($mail_to, $mail_subject, $mail_body)) {
echo "mail sent successfully!";
} else {
echo "failed to send";
}
?>

The variables are sent via a form from the previous page.

What am I doing wrong??

Thanks.

Reply With Quote
  #2  
Old January 23rd, 2003, 07:21 PM
Jeb. Jeb. is offline
"l33t? What's l33t?"
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 51 Jeb. User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to Jeb.
if ($mail(....

When you place parenthesis after a variable, PHP will do the following:

It will expand the variable, and then try to execute a function that has the same name as the value of the variable.

For exampe, if you stored the text "is_array" in a variable named $foo, and then did this: $foo($myarray), it would execute the "is_array" function.

So, what you need to do is take that dollar sign off of the mail() function.

And thus endeth the sermon.
-Jeb.
__________________
Jeb.

AIM: JebediahMc - PM Me - E-Mail Me


Reply With Quote
  #3  
Old January 23rd, 2003, 07:52 PM
Quantum Quantum is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Canada
Posts: 15 Quantum User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile It worked!!

What a bonehead move! Thanks Dude.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Mail() not working


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway