lammy
Posts: 49
|
| Posted: 12/28/2004, 2:52 AM |
|
hi all
Im running through the tutorials for ccs but I have a problem with the sending of emails to people who have been assigned a task. I have cut and pasted the code from the help file into my project but I get this error when i submit a task
Fatal error: Call to a member function on a non-object in c:\program files\nusphere\techplat\apache\htdocs\taskmanager\tasks_maint_events.php on line 21
Could somebody enlighten me as to why I get the error. everything is as the taskmanager should be. the only thing thats changed is the connection isnt Intranet
heres the code as from the help file.
global $DBIntranetDB;
global $tasks;
$from_name = CCDLookUp("emp_name", "employees", "emp_id=".
$DBIntranetDB->ToSQL(CCGetUserID(), ccsInteger), $DBIntranetDB);
$from_email = CCDLookUp("email", "employees", "emp_id=".
$DBIntranetDB->ToSQL(CCGetUserID(), ccsInteger), $DBIntranetDB);
$to_email = CCDLookUp("email", "employees", "emp_id=".
$DBIntranetDB->ToSQL($tasks->user_id_assign_to->GetValue(), ccsInteger), $DBIntranetDB);
$headers = "From: ".$from_name."<".$from_email.">;";
$headers .= "Content-Type: text/html";
$subject = "New task for you";
$message = "The following task was submitted:<br><br>".
"Task ID: ".CCDLookUp("max(task_id)", "tasks", "user_id_assign_by=".
$DBIntranetDB->ToSQL(CCGetUserID(), ccsInteger), $DBIntranetDB)."<br><br>".
$tasks->task_desc->GetText();
mail ($to_email,$subject,$message,$headers);
Thanks
|
 |
 |
peterr
Posts: 5971
|
| Posted: 12/29/2004, 1:41 AM |
|
Since no one responded I suspect that this problem can be difficult to analyze without working with your project and debugging it.
Main question could be: which one is line 21 in the above code?
And the main thing that I would check first is if your form name is indeed "tasks" and your connection name is "IntranetDB" in your CCS project.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
lammy
Posts: 49
|
| Posted: 12/29/2004, 3:30 AM |
|
Hi peter
Thanks for reply,
you where right with DB my connection is called golfers and i had put as $DBgolfersDB managed to get further now but still wont work as this appears now
Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in c:\program files\nusphere\techplat\apache\htdocs\taskmanager\tasks_events.php on line 35
Warning: Cannot modify header information - headers already sent by (output started at c:\program files\nusphere\techplat\apache\htdocs\taskmanager\tasks_events.php:35) in c:\program files\nusphere\techplat\apache\htdocs\taskmanager\tasks.php on line 640
My Code
global $DBgolfers;
global $tasks;
$from_name = CCDLookUp("emp_name", "employees", "emp_id=".
$DBgolfers->ToSQL(CCGetUserID(), ccsInteger), $DBgolfers);
$from_email = CCDLookUp("email", "employees", "emp_id=".
$DBgolfers->ToSQL(CCGetUserID(), ccsInteger), $DBgolfers);
$to_email = CCDLookUp("email", "employees", "emp_id=".
$DBgolfers->ToSQL($tasks->user_id_assign_to->GetValue(), ccsInteger), $DBgolfers);
$headers = "From: ".$from_name."<".$from_email.">;";
$headers .= "Content-Type: text/html";
$subject = "New task for you";
$message = "The following task was submitted:<br><br>".
"Task ID: ".CCDLookUp("max(task_id)", "tasks", "user_id_assign_by=".
$DBgolfers->ToSQL(CCGetUserID(), ccsInteger), $DBgolfers)."<br><br>".
$tasks->task_desc->GetText();
echo $from_name;
echo $from_email;
echo $to_email;
echo $message;
mail ($to_email,$subject,$message,$headers); LINE 35 
I would appreciate some help
Cheers
Lammy
|
 |
 |
Martin K.
|
| Posted: 12/29/2004, 8:35 AM |
|
Hello.
Try this, maybe it works.
global $DBgolfers;
global $tasks;
$from_name = CCDLookUp("emp_name", "employees", "emp_id=".
CCToSQL(CCGetUserID(), ccsInteger)."", $DBgolfers);
$from_email = CCDLookUp("email", "employees", "emp_id=".
CCToSQL(CCGetUserID(), ccsInteger)."", $DBgolfers);
$to_email = CCDLookUp("email", "employees", "emp_id=".
CCToSQL($tasks->user_id_assign_to->GetValue(), ccsInteger)."", $DBgolfers);
$headers = "From: ".$from_name."<".$from_email.">;";
$headers .= "Content-Type: text/html";
$subject = "New task for you";
$message = "The following task was submitted:<br><br>".
"Task ID: ".CCDLookUp("max(task_id)", "tasks", "user_id_assign_by=".
CCToSQL(CCGetUserID(), ccsInteger)."", $DBgolfers)."<br><br>".
$tasks->task_desc->GetText();
echo $from_name;
echo $from_email;
echo $to_email;
echo $message;
mail ($to_email,$subject,$message,$headers);
Greets Martin
|
|
|
 |
|