|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
What a bonehead move! Thanks Dude.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Mail() not working |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|