Charlie
|
| Posted: 03/07/2005, 5:12 PM |
|
I am sure everyone has seen this code for ASPEMAIL:
Dim Mailer
Set Mailer = Server.CreateObject("Persits.MailSender")
Mailer.From = CCDLookUp("email", "employees", "emp_id=" &_
DBIntranetDB.ToSQL(CCGetUserID(),ccsInteger), DBIntranetDB)
Mailer.FromName = CCDLookUp("emp_name", "employees", "emp_id=" &_
DBIntranetDB.ToSQL(CCGetUserID(), ccsInteger), DBIntranetDB)
Mailer.AddAddress CCDLookUp("email", "employees", "emp_id=" &_
DBIntranetDB.ToSQL(tasks.user_id_assign_to.Value, ccsInteger), DBIntranetDB)
Mailer.Host = "mysmtphost.com"
Mailer.IsHTML = True
Mailer.Subject = "New task for you"
Mailer.Body = "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.Text
Mailer.Send
set Mailer = Nothing
I have tried repeatedly to convert this over to CDONTS, but as I am just getting started I am not having any luck. The application will work perfectly for what I need, save for sending out the email. Is there anyone out there that can help out and convert this code to the proper format to use CDONTS? At least at that point I (and probably others) would have a good beginning in understanding. Thanks!!
|
|
|
 |
Oper
Posts: 1195
|
| Posted: 03/08/2005, 4:26 AM |
|
CDONT & ASP MAIL http://www.globaldevelop.com/GlobalDevelop/Forum/forum_...asp?TID=34&PN=1
(Clean Code)
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
 |
 |
Charlie
|
| Posted: 03/08/2005, 7:47 AM |
|
Thanks, but I have seen these examples already, I need this specific code re-worked into one that would work with CDONT so that I can just drop it in place and get going. Yes, I know - read the book...but if anyone could help me out, I would appreciate it.
|
|
|
 |
Oper
Posts: 1195
|
| Posted: 03/08/2005, 9:41 AM |
|
Haha, OK , Let me know if worked
Function CDONTSendEmail()
Dim MailOBJ
Set MailOBJ = Server.CreateObject("CDONTS.NewMail")
MailOBJ.From = CCDLookUp("email", "employees", "emp_id=" & DBIntranetDB.ToSQL(CCGetUserID(),ccsInteger), DBIntranetDB)
MailOBJ.to = CCDLookUp("email", "employees", "emp_id=" & DBIntranetDB.ToSQL(tasks.user_id_assign_to.Value, ccsInteger),DBIntranetDB)
MailOBJ.Subject = "New task for you"
MailOBJ.Body = "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.Text
MailOBJ.BodyFormat = 0
MailOBJ.MailFormat = 1
MailOBJ.Importance = 1
MailOBJ.Send
set MailOBJ=Nothing
End Function
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
 |
 |
Charlie
|
| Posted: 03/08/2005, 7:01 PM |
|
Thanks!!
I think the code will work fine and I see where I was making my mistake before in not setting the object for each condition.
New questions: To make this work correctly after entering information into a form, should it be assigned to the onclick event of the button on the form or is there some other location like after inputting the data to the database? Sorry for the dreadful questions, but just trying to figure out how this goes together.
|
|
|
 |
Oper
Posts: 1195
|
| Posted: 03/08/2005, 9:13 PM |
|
It alwasy depend.
But my guess for your case will be After Insert
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
 |
 |
Charlie
|
| Posted: 03/15/2005, 6:26 AM |
|
Theere must be something that we are missing, with the code in place and entering information to the database upon hitting the input button the app fails to go back to it's preset return page and provides an error. If I remove this code, the app performs flawlessly.
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 03/15/2005, 10:50 AM |
|
I recommend that you always provide the full text of your error message if you need help.
It may be impossible for someone else to solve a problem if you're the only one who knows what happens...
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
Charlie
|
| Posted: 03/15/2005, 11:28 AM |
|
Right, but a HTTP 500 Internal Server error is hardly worth noting. The bottom line is that the code above prevents the app from returning to the "return page", so I am asking that the person who graciously provided the code to take another look at it if they will.
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 03/15/2005, 11:36 AM |
|
OK, just trying to see if I or anyone else can help before Oper is available. I wouldn't be able to fix such problem without knowing more details about the error.
In case of error 500, it is actually a problem with your browser's configuration, so I would fix that first. It may help you a lot with debugging future issues.
Take a look at http://www.google.com/search?hl=en&lr=&q=HTTP+500+Inter...ror&btnG=Search
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
Charlie
|
| Posted: 03/15/2005, 8:11 PM |
|
okay- got you. I'll come back with more detail. -thanks!
|
|
|
 |
Charlie
|
| Posted: 03/16/2005, 8:04 AM |
|
The problem now has to do with the variable "tasks" and it id's this line of code:
MailOBJ.to = CCDLookUp("email", "employees", "emp_id=" & DBIntranetDB.ToSQL(tasks.user_id_assign_to.Value, ccsInteger),DBIntranetDB)
The error states that "tasks" as a variable has not been defined.
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 03/16/2005, 3:06 PM |
|
Sorry to keep you waiting. Looks like for some reason the program doesn't see the form named "tasks".
Just so that you can focus on fixing this specific issue, I would recommend that you insert this code somewhere before the error occurs:
response.write tasks.user_id_assign_to.Value"
response.end
Your page then should display the value of the "user_id_assign_to" field. If not, then possibly you're witihin an event that doesn't "see" the "tasks" form. Do you have such form on your page? And which event did you use? I think that it should be the "After Insert" and/or "After Update" event of a form.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
Charlie
|
| Posted: 03/16/2005, 6:41 PM |
|
This is the Task Manager example code that comes with the software. We have made no changes to it other than attempting to insert the CDONTS for emailing the "tasks" to the specific email account.
I guess I misunderstand the code, because in that line I thought the reference to "tasks" was the Access db table - "tasks", not a form that it was looking for.
I will try to insert the code you have suggested.
The After Insert event is where this code is positioned.
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 03/17/2005, 12:12 AM |
|
Sorry, I'm confused now and not sure if you're using the Task Manager example, or the Task Management tutorial. They are not related and not compatible, therefore you'd either need to follow the tutorial and create your own Task Management application based on it, or you'd need to modify the tutorial code (or other code if you found it elsewhere) to work with your project.
tasks.user_id_assign_to.Value refers to the value of the the "user_id_assign_to" field on the "tasks" form.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
Charlie
|
| Posted: 03/17/2005, 3:55 AM |
|
It is the Task Manager example code that we are using for the application.
|
|
|
 |
Oper
Posts: 1195
|
| Posted: 03/17/2005, 5:56 AM |
|
I will see the sample charlie promise i iwll get back as sson i downloaded.
should be somethign simple missing.
are you using pure ASP?
Note: In Explorer go to Tool/Internet Option/Advanced (check or unchek) show friend URL so Eplorer will display the real erroe not the friendly 500 error URL.
Also coudl you test first changing your line for:
Mailobj.to = "CharlieEmail@Domainwhatverve.com"
Just as a test.
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
 |
 |
Oper
Posts: 1195
|
| Posted: 03/17/2005, 5:57 AM |
|
as a charlie email i mean some of your real email.
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
 |
 |
Charlie
|
| Posted: 03/17/2005, 9:54 AM |
|
The test gave the same result. If you are checking to see if CDONTS works on this server, it does as we have another application that is working fine.
|
|
|
 |
Oper
Posts: 1195
|
| Posted: 03/17/2005, 10:18 AM |
|
Perfect.. so basicly the problem is with the CCDLookup.
cuase is sa impel interger you could use this
MailOBJ.to = CCDLookUp("email", "employees", "emp_id=" & tasks.user_id_assign_to.Value,DBIntranetDB)
tasks.user_id_assign_to.Value
1) There is a Task Named Form?
2) There is a field named user_id_assign_to?
3) Does that field has Value?
One Debug to help undertand what is going on is do this: on that sentence
response.write tasks.user_id_assign_to.Value
response.end
MailOBJ.to = CCDLookUp("email", "employees", "emp_id=" & DBIntranetDB.ToSQL(tasks.user_id_assign_to.Value, ccsInteger),DBIntranetDB)
just to check if som value is on that variable.
let me knwo to check next step.
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
 |
 |
peterr
Posts: 5971
|
| Posted: 03/17/2005, 10:29 AM |
|
Charlie,
This code may not work correctly with the Task Manager example because it was not written for that example.
I recommend that you simply use the CCS Tutorial from beginning and in 30 minutes you will have an example that works.
You will also learn how to quickly create Web applications and add custom code, as described in the tutorial. The tutorial also explains each line of code and you can modify it as you wish.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
charlie
Posts: 1
|
| Posted: 03/17/2005, 11:14 AM |
|
There is a form named "task" or as the error puts it ccsForm=task
The error also keeps asking about the variable that is named "tasks" not "task".
Microsoft VBScript runtime error '800a01f4'
Variable is undefined: 'tasks'
/task/TaskRecord_events.asp, line 27
Anyway, I appreciate the help but I do not want to waste any additional time on this. I needed to have this app up and running long before this and it should not be that complicated to add email notification to this example.
|
 |
 |
peterr
Posts: 5971
|
| Posted: 03/17/2005, 11:45 AM |
|
OK, then why wouldn't you change the above code to reflect "task" instead of "tasks" as mentioned so many times above?
It's 100% guaranteed that no code will work if it is not adapated to your specific case.
Resolving this issue takes only 1 minute - you'd view the error, then adjust your code accordingly and it's fixed.
This is not even related to this application, just being able to copy the code and then change 1 character: "tasks" to "task", or whatever your form's name is.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
peterr
Posts: 5971
|
| Posted: 03/17/2005, 12:02 PM |
|
Charlie, I also responded to your PM and hope we can get this working for you.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
Oper
Posts: 1195
|
| Posted: 03/17/2005, 2:02 PM |
|
as Peterr said if the form is named task, why are you using tasks?
maybe that will fix your code.
Quote charlie:
 There is a form named "task" or as the error puts it ccsForm=task
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
 |
 |