Your sendmail.properties
sendMailURL=/jsp/sendmail.jsp sendMailURL.formHandlerName=sendMailURLForm sendMailURL.transformType=jsp request.sendMailURL.transform.className=com.ai.jsp.JSPTransform request.sendMailURLForm.form_handler.class_request.className=com.ai.htmlgen.DBHashTableFormHandler1 request.sendMailURLForm.classname=com.ai.db.DBPreTranslateArgsMultiRequestExecutor request.sendMailURLForm.db=testDB request.sendMailURLForm.query_type=select ## Start the pipeline request.sendMailURLForm.request.1=GetFromToSubject request.sendMailURLForm.request.2=FinalSendMail request.sendMailURLForm.request.3=GetBodyText ## One possible way to get the from, to, and subject fields ## Or you could pass them from your input request directly ## request.GetFromToSubject.classname=com.ai.db.DBRequestExecutor2 request.GetFromToSubject.db=testDB request.GetFromToSubject.stmt= select toadd as toa,fromadd as froma,sub as suba from usertable1 where useid = {useid1} ##Expected inputs ##from, to, subject, bodyText request.FinalSendMail.classname=com.ai.aspire.utils.MailRequestExecutor request.FinalSendMail.smtpMailHost=smtp.eth.net [email protected] request.FinalSendMail.password=reset123 #http://localhost:8080/avada/display?url=DisplayURL&ordid=465&useid1=43534563 # USing the URLStringReader to retrieve a url as a string # request.GetBodyText.classname=com.ai.parts.URLStringReaderPart request.GetBodyText.URL=/avada/display?url=DisplayURL&ordid={ordid}&useid1={useid1} request.GetBodyText.resultName=bodyText
Problem1 - Mistaking Update with Display
Aspire has two distinct entry points. One for displaying data and one for performing work on the server side. The later is in genreal synonymous with a database update. These two entry points are named
display update
display is responsible for retrieving and painting data on a web page. It is not capable of anything else. The invocation for this looks like
http://host/display?url=SomeURL&arg1=aaa
Update is more involved. The primary functionality of update is to call a server side java action class that does something (in this case sendmail) and then redirect it to a display that I talked earlier. In this case sending email is a server side activity. That means it will have the following
1. A request name to kick off the action pipeline 2. One of the action pipeline items will be email 3. Usually sending email action is the last in the pipeline 4. A redirection to a display page once sending email completes
With this in mind the following section is not needed
sendMailURL=/jsp/sendmail.jsp
sendMailURL.formHandlerName=sendMailURLForm
sendMailURL.transformType=jsp
request.sendMailURL.transform.className=com.ai.jsp.JSPTransform
request.sendMailURLForm.form_handler.class_request.className=com.ai.htmlgen.DBHashTableFormHandler1
More over the sending mail as I have mentioned is a request. So more appropriate name is
sendMailRequest
Start of the corrected email properties
request.sendMailRequest.classname=com.ai.db.DBPreTranslateArgsMultiRequestExecutor
request.sendMailRequest.db=testDB
Notice that sendMail is not a URL or a form but a request. Also notice that "query_type" is optional when it is "select" and can be omited. These lines are usually followed by a redirection.
Redirecting to a page after sending email
request.sendMailRequest.redirectURL=/{aspireContext}/display?url=EmailSuccessfullySentURL
request.sendMailRequest.failureRedirectURL=/{aspireContext}/display?url=EmailFailureURL
These are only examples. You can redirect them to any page you want. Now let me come to the actual pipeline that sends the email
Problem 2: GetBodyText should come before FinalSendMail
## Start the pipeline
request.sendMailRequest.request.1=GetFromToSubject
request.sendMailRequest.request.2=GetBodyText
request.sendMailRequest.request.3=FinalSendMail
Notice how GetBodyText happens first.
Problem 3: Name your fields to match what sendmail is expecting
## One possible way to get the from, to, and subject fields
## Or you could pass them from your input request directly
##
request.GetFromToSubject.classname=com.ai.db.DBRequestExecutor2
request.GetFromToSubject.db=testDB
request.GetFromToSubject.stmt=\
select toadd as to, \
fromadd as from, \
sub as subject \
from usertable1 \
where useid = {useid1}
Notice how you have named the fields to match the fields expected by the sendmail. Also notice how you have broken the select statement for clarity and how the new line character is the last character on the line
# USing the URLStringReader to retrieve a url as a string
#
request.GetBodyText.classname=com.ai.parts.URLStringReaderPart
request.GetBodyText.URL=/avada/display?url=DisplayURL&ordid={ordid}&useid1={useid1}
request.GetBodyText.resultName=bodyText
This section will read your JSP page that contains the format of the email.
##Expected inputs
##from, to, subject, bodyText
request.FinalSendMail.classname=com.ai.aspire.utils.MailRequestExecutor
request.FinalSendMail.smtpMailHost=smtp.eth.net
request.FinalSendMail.user=(sorry)
request.FinalSendMail.password=(sorry)
I have removed your user and password for security reasons.
Conclusion
Ramesh, hope this helps. Send an email to the aspire groups. If you have any problem. Or I can add you to AKC as a user, then you can directly type your response on this page itself. And here is the final complete properties in one place
#Identify the server side action
#In this case it is a pipeline
request.sendMailRequest.classname=com.ai.db.DBPreTranslateArgsMultiRequestExecutor
request.sendMailRequest.db=testDB
#Identify where to go next
request.sendMailRequest.redirectURL=/{aspireContext}/display?url=EmailSuccessfullySentURL
request.sendMailRequest.failureRedirectURL=/{aspireContext}/display?url=EmailFailureURL
## Define the pipeline
request.sendMailRequest.request.1=GetFromToSubject
request.sendMailRequest.request.2=GetBodyText
request.sendMailRequest.request.3=FinalSendMail
## Get from, to, and subject fields
request.GetFromToSubject.classname=com.ai.db.DBRequestExecutor2
request.GetFromToSubject.db=testDB
request.GetFromToSubject.stmt=\
select toadd as to, \
fromadd as from, \
sub as subject \
from usertable1 \
where useid = {useid1}
# GetBodyText
# USing the URLStringReader to retrieve a url as a string
request.GetBodyText.classname=com.ai.parts.URLStringReaderPart
request.GetBodyText.URL=/avada/display?url=DisplayURL&ordid={ordid}&useid1={useid1}
request.GetBodyText.resultName=bodyText
##Expected inputs
##from, to, subject, bodyText
#Finally invoke the mail executor to send the mail
request.FinalSendMail.classname=com.ai.aspire.utils.MailRequestExecutor
request.FinalSendMail.smtpMailHost=smtp.eth.net
request.FinalSendMail.user=(sorry)
request.FinalSendMail.password=(sorry)