Hello;
hope someone can point me in the right direction.
Have a PHP form on our website which sends the user info to a Notes DB. It is working fine, however, I have a token manual agent that , when activated, should send the same info into a form which is sent in an email. The user is receiving the form with blank fields.
Could this be something to do with Char13 or how the agent is formatting?
Below is the agent code. I appreciate any help or direction. If you need any more information(I know this is sketchy) please let me know...
Sub Initialize
Dim session As New NotesSession
Dim view As NotesView
Dim newresponse As notesdocument
Dim db As notesdatabase
Set db = session.CurrentDatabase
Dim doc As notesdocument
Dim notesDocumentCollection As notesDocumentCollection
Dim dc As notesdocumentcollection
Dim emailbody As String
Dim temp, temp2 , temp3 As String
Dim i As Integer
Set dc = db.UnprocessedDocuments
Set doc = dc.GetFirstDocument
Do
i =0
If (doc.processed(0) = "" Or doc.processed(0)=Null Or doc.processed(0)="no") And doc.From(0)="correct email" Then
' Messagebox "value=" +doc.Body(0), 0, "STOP"
emailbody=doc.Body
'Parse Body Field from New Mail and input into respective Notes Fields
temp = Strtoken(emailbody, Chr(13),0)
'Messagebox "value=" +temp , 0, "STOP"
temp2 = Strtoken(temp,": ",0)
temp3 = Strtoken(temp,": ",2)
Set doc2 = New NotesDocument( db )
doc2.Form="AWAREApp"
Do
i=i+1
If (temp<>Null) Or temp <> "" Then
'Messagebox "value=" +temp3 , 0, "STOP"
'Messagebox "value=" +Strtoken(temp,": ",2) , 0, "STOP"
Select Case temp2
Case "Company_Name" : doc2.cname=temp3
Case "Address" : doc2.caddress=temp3
Case "City" : doc2.ccity=temp3
Case "State" : doc2.cstate=temp3
Case "Zip" : doc2czip=temp3
Case "Country" : doc2.ccountry=temp3
Case "Phone" : doc2.cphone=temp3
Case "Website" : doc2.cweb=temp3
Case "ApplicantsName" : doc2.cappname=temp3
Case "salesmanagername" : doc2.sname=temp3
Case "salesmanagertitle" : doc2.stitle=temp3
Case "salesmanagerphone" : doc2.sphone=temp3
Case "salesmanagerfax" : doc2.sfax=temp3
Case "salesmanageremail" : doc2.semail=temp3
Case "marketingname" : doc2.mname=temp3
Case "marketingtitle" : doc2.mtitle=temp3
Case "marketingphone" : doc2.mphone=temp3
Case "marketingfax" : doc2.mfax=temp3
Case "marketingemail" : doc2.memail=temp3
Case "technicalname" : doc2.tname=temp3
Case "technicaltitle" : doc2.ttile=temp3
Case "technicalphone" : doc2.tphone=temp3
Case "technicalfax" : doc2.tfax=temp3
Case "technicalemail" : doc2.temail=temp3
Case "accountingname" : doc2.aname=temp3
Case "accountingtitle" : doc2.atitle=temp3
Case "accountingphone" : doc2.aphone=temp3
Case "accountingfax" : doc2.afax=temp3
Case "accountingemail" : doc2.aemail=temp3
Case "purchasingname" : doc2.pname=temp3
Case "purchasingtitle" : doc2.ptitle=temp3
Case "purchasingphone" : doc2.pphone=temp3
Case "purchasingfax" : doc2.pfax=temp3
Case "purchasingemail" : doc2.pemail=temp3
Case "primarybusiness" : doc2.cbusiness=temp3
Case "yearestablished" : doc2.cyear=temp3
Case "verticalmarketfocus.digitalvideo" : doc2.digitalaudio=temp3
Case "verticalmarketfocus.digitalaudio" : doc2.digitalvideo=temp3
Case "verticalmarketfocus.documentimaging" : doc2.documentimaging=temp3
Case "verticalmarketfocus.storagemanagement" : doc2.storagemanagement=temp3
Case "verticalmarketfocus.networking" : doc2.networking=temp3
Case "employeebreakdown.insidesales" : doc2.inside=temp3
Case "employeebreakdown.outsidesales" : doc2.outside=temp3
Case "employeebreakdown.technicalsupport" : doc2.technicalsupport=temp3
Case "employeebreakdown.marketing" : doc2.marketingsupport=temp3
Case "computerplatforms.apple" : doc2.apple=temp3
Case "computerplatforms.dec" : doc2.dec=temp3
Case "computerplatforms.pccomputer" : doc2.pc=temp3
Case "computerplatforms.dg" : doc2.dg=temp3
Case "computerplatforms.sgmips" : doc2.sg=temp3
Case "computerplatforms.ibmrs6000" : doc2.ibmrs6000=temp3
Case "computerplatforms.sun" : doc2.sun=temp3
Case "computerplatforms.hpapollo" : doc2.hp=temp3
Case "computerplatforms.other" : doc2.other=temp3
Case "valueaddedservicesprovided" : doc2.valueadd=temp3
Case "howattofits" : doc2.companyfocus=temp3
Case "canattoassist" : doc2.marketinggoals=temp3
Case "competingproductssold" : doc2.competingproducts=temp3
Case "productline1.name" : doc2.attoprod1=temp3
Case "productline1.1st3months" : doc2.first3prod1=temp3
Case "productline1.2nd3months" : doc2.secprod1=temp3
Case "productline1.3rd3months" : doc2.thirprod1=temp3
Case "productline1.4th3months" : doc2.forprod1=temp3
Case "productline2.name" : doc2.attoprod2=temp3
Case "productline2.1st3months" : doc2.first3prod2=temp3
Case "productline2.2nd3months" : doc2.secprod2=temp3
Case "productline2.3rd3months" : doc2.thirprod2=temp3
Case "productline2.4th3months" : doc2.forprod2=temp3
Case "productline3.name" : doc2.attoprod3=temp3
Case "productline3.1st3months" : doc2.first3prod3=temp3
Case "productline3.2nd3months" : doc2.secprod3=temp3
Case "productline3.3rd3months" : doc2.thirprod3=temp3
Case "productline3.4th3months" : doc2.forprod3=temp3
Case "productline4.name" : doc2.attoprod4=temp3
Case "productline4.1st3months" : doc2.first3prod4=temp3
Case "productline4.2nd3months" : doc2.secprod4=temp3
Case "productline4.3rd3months" : doc2.thirprod4=temp3
Case "productline4.4th3months" : doc2.forprod4=temp3
Case "notes" : doc2.notes=temp3
Case "contactnameprint" : doc2.contactnameprint=temp3
Case "attoassociateprint" : doc2.attoassociateprint=temp3
Case "contactnamesignature" : doc2.contactnamesignature=temp3
Case "attoassociatesignature" : doc2.attoassociatesignaturee=temp3
End Select
End If
emailbody=Strright(emailbody,Chr(10)) 'Process rest of paragraph minus previous line
' Messagebox "Body is. " +emailbody, 0, "STOP"
temp = Strtoken(emailbody, Chr(13),0)
' Messagebox "left of body is =" +Strleft(emailbody, Chr(12)) , 0, "STOP"
' Messagebox "value=" +temp , 0, "STOP"
' Messagebox "value=" +Strtoken(temp,": ",1) , 0, "STOP"
' Messagebox "value=" +Strtoken(temp,": ",2) , 0, "STOP"
If Len(temp)<1 Then
'previous was a blank line process next line
emailbody=Strright(emailbody,Chr(10))
temp = Strtoken(emailbody, Chr(10),0)
End If
' Messagebox "value=" +temp , 0, "STOP"
temp2 = Strtoken(temp,": ",0)
' Messagebox "value=" +temp2 , 0, "STOP"
temp3 = Strtoken(temp,": ",2)
'find the value between the 2 colons. This will give us user input
Dim content, backup As String
content = Strright(emailbody,": ")
backup = content
content = Strleft(content,":")
content = Strleft(content,(Chr(13)+Chr(10)+Chr(13)+Chr(10))) 'Go up 2 lines
'if there are 2 endlines in a row then it is a blank line
If Len(Strleft(content,(Chr(13)+Chr(10)+Chr(13)))) > 1 Then
temp3 = Strtoken(temp,": ",2)
temp3=content
Else
'Check again if this is the last token
If Len(content) <1 Then
Else
temp3 = Strleftback(Strtoken(temp,": ",2),Chr(13))
temp3=content
End If
End If
' If temp2="howattofits" Then
' Messagebox "value of TEMP2= " +Strtoken(temp,": ",2) , 0, "STOP"
' End If
' temp3=content
' temp3 = Strleftback(temp3,Chr(13))
' newemailbody = Strright(emailbody,Chr(13))
Loop Until (temp3=Null Or i>135)
doc.processed = "yes"
Call doc.Save(True,True)
Call doc2.save(True,True)
'Notify selected people of new AWARE application
Dim doc18 As NotesDocument
Dim rtitem As NotesRichTextItem
Set doc18 = New NotesDocument( db )
Set rtitem = New NotesRichTextItem( doc18, "Body" )
doc18.Form = "Memo2"
doc18.Subject = "New Advantage Partner Application"
rtitem.appendText("Please take a look at new application for AWARE Partner received from ATTO Website")
rtitem.addnewline(3)
rtitem.appendText("Click link to open")
rtitem.addnewline(2)
Dim recipients(1) As String
recipients(0) = "correct email"
Call rtitem.appendDocLink(doc2, db.Title)
Call doc18.Send( True, recipients)
End If
Set doc2 = dc.GetNextDocument(doc)
Set doc = doc2
Loop Until (doc Is Nothing)
End Sub
hope someone can point me in the right direction.
Have a PHP form on our website which sends the user info to a Notes DB. It is working fine, however, I have a token manual agent that , when activated, should send the same info into a form which is sent in an email. The user is receiving the form with blank fields.
Could this be something to do with Char13 or how the agent is formatting?
Below is the agent code. I appreciate any help or direction. If you need any more information(I know this is sketchy) please let me know...
Sub Initialize
Dim session As New NotesSession
Dim view As NotesView
Dim newresponse As notesdocument
Dim db As notesdatabase
Set db = session.CurrentDatabase
Dim doc As notesdocument
Dim notesDocumentCollection As notesDocumentCollection
Dim dc As notesdocumentcollection
Dim emailbody As String
Dim temp, temp2 , temp3 As String
Dim i As Integer
Set dc = db.UnprocessedDocuments
Set doc = dc.GetFirstDocument
Do
i =0
If (doc.processed(0) = "" Or doc.processed(0)=Null Or doc.processed(0)="no") And doc.From(0)="correct email" Then
' Messagebox "value=" +doc.Body(0), 0, "STOP"
emailbody=doc.Body
'Parse Body Field from New Mail and input into respective Notes Fields
temp = Strtoken(emailbody, Chr(13),0)
'Messagebox "value=" +temp , 0, "STOP"
temp2 = Strtoken(temp,": ",0)
temp3 = Strtoken(temp,": ",2)
Set doc2 = New NotesDocument( db )
doc2.Form="AWAREApp"
Do
i=i+1
If (temp<>Null) Or temp <> "" Then
'Messagebox "value=" +temp3 , 0, "STOP"
'Messagebox "value=" +Strtoken(temp,": ",2) , 0, "STOP"
Select Case temp2
Case "Company_Name" : doc2.cname=temp3
Case "Address" : doc2.caddress=temp3
Case "City" : doc2.ccity=temp3
Case "State" : doc2.cstate=temp3
Case "Zip" : doc2czip=temp3
Case "Country" : doc2.ccountry=temp3
Case "Phone" : doc2.cphone=temp3
Case "Website" : doc2.cweb=temp3
Case "ApplicantsName" : doc2.cappname=temp3
Case "salesmanagername" : doc2.sname=temp3
Case "salesmanagertitle" : doc2.stitle=temp3
Case "salesmanagerphone" : doc2.sphone=temp3
Case "salesmanagerfax" : doc2.sfax=temp3
Case "salesmanageremail" : doc2.semail=temp3
Case "marketingname" : doc2.mname=temp3
Case "marketingtitle" : doc2.mtitle=temp3
Case "marketingphone" : doc2.mphone=temp3
Case "marketingfax" : doc2.mfax=temp3
Case "marketingemail" : doc2.memail=temp3
Case "technicalname" : doc2.tname=temp3
Case "technicaltitle" : doc2.ttile=temp3
Case "technicalphone" : doc2.tphone=temp3
Case "technicalfax" : doc2.tfax=temp3
Case "technicalemail" : doc2.temail=temp3
Case "accountingname" : doc2.aname=temp3
Case "accountingtitle" : doc2.atitle=temp3
Case "accountingphone" : doc2.aphone=temp3
Case "accountingfax" : doc2.afax=temp3
Case "accountingemail" : doc2.aemail=temp3
Case "purchasingname" : doc2.pname=temp3
Case "purchasingtitle" : doc2.ptitle=temp3
Case "purchasingphone" : doc2.pphone=temp3
Case "purchasingfax" : doc2.pfax=temp3
Case "purchasingemail" : doc2.pemail=temp3
Case "primarybusiness" : doc2.cbusiness=temp3
Case "yearestablished" : doc2.cyear=temp3
Case "verticalmarketfocus.digitalvideo" : doc2.digitalaudio=temp3
Case "verticalmarketfocus.digitalaudio" : doc2.digitalvideo=temp3
Case "verticalmarketfocus.documentimaging" : doc2.documentimaging=temp3
Case "verticalmarketfocus.storagemanagement" : doc2.storagemanagement=temp3
Case "verticalmarketfocus.networking" : doc2.networking=temp3
Case "employeebreakdown.insidesales" : doc2.inside=temp3
Case "employeebreakdown.outsidesales" : doc2.outside=temp3
Case "employeebreakdown.technicalsupport" : doc2.technicalsupport=temp3
Case "employeebreakdown.marketing" : doc2.marketingsupport=temp3
Case "computerplatforms.apple" : doc2.apple=temp3
Case "computerplatforms.dec" : doc2.dec=temp3
Case "computerplatforms.pccomputer" : doc2.pc=temp3
Case "computerplatforms.dg" : doc2.dg=temp3
Case "computerplatforms.sgmips" : doc2.sg=temp3
Case "computerplatforms.ibmrs6000" : doc2.ibmrs6000=temp3
Case "computerplatforms.sun" : doc2.sun=temp3
Case "computerplatforms.hpapollo" : doc2.hp=temp3
Case "computerplatforms.other" : doc2.other=temp3
Case "valueaddedservicesprovided" : doc2.valueadd=temp3
Case "howattofits" : doc2.companyfocus=temp3
Case "canattoassist" : doc2.marketinggoals=temp3
Case "competingproductssold" : doc2.competingproducts=temp3
Case "productline1.name" : doc2.attoprod1=temp3
Case "productline1.1st3months" : doc2.first3prod1=temp3
Case "productline1.2nd3months" : doc2.secprod1=temp3
Case "productline1.3rd3months" : doc2.thirprod1=temp3
Case "productline1.4th3months" : doc2.forprod1=temp3
Case "productline2.name" : doc2.attoprod2=temp3
Case "productline2.1st3months" : doc2.first3prod2=temp3
Case "productline2.2nd3months" : doc2.secprod2=temp3
Case "productline2.3rd3months" : doc2.thirprod2=temp3
Case "productline2.4th3months" : doc2.forprod2=temp3
Case "productline3.name" : doc2.attoprod3=temp3
Case "productline3.1st3months" : doc2.first3prod3=temp3
Case "productline3.2nd3months" : doc2.secprod3=temp3
Case "productline3.3rd3months" : doc2.thirprod3=temp3
Case "productline3.4th3months" : doc2.forprod3=temp3
Case "productline4.name" : doc2.attoprod4=temp3
Case "productline4.1st3months" : doc2.first3prod4=temp3
Case "productline4.2nd3months" : doc2.secprod4=temp3
Case "productline4.3rd3months" : doc2.thirprod4=temp3
Case "productline4.4th3months" : doc2.forprod4=temp3
Case "notes" : doc2.notes=temp3
Case "contactnameprint" : doc2.contactnameprint=temp3
Case "attoassociateprint" : doc2.attoassociateprint=temp3
Case "contactnamesignature" : doc2.contactnamesignature=temp3
Case "attoassociatesignature" : doc2.attoassociatesignaturee=temp3
End Select
End If
emailbody=Strright(emailbody,Chr(10)) 'Process rest of paragraph minus previous line
' Messagebox "Body is. " +emailbody, 0, "STOP"
temp = Strtoken(emailbody, Chr(13),0)
' Messagebox "left of body is =" +Strleft(emailbody, Chr(12)) , 0, "STOP"
' Messagebox "value=" +temp , 0, "STOP"
' Messagebox "value=" +Strtoken(temp,": ",1) , 0, "STOP"
' Messagebox "value=" +Strtoken(temp,": ",2) , 0, "STOP"
If Len(temp)<1 Then
'previous was a blank line process next line
emailbody=Strright(emailbody,Chr(10))
temp = Strtoken(emailbody, Chr(10),0)
End If
' Messagebox "value=" +temp , 0, "STOP"
temp2 = Strtoken(temp,": ",0)
' Messagebox "value=" +temp2 , 0, "STOP"
temp3 = Strtoken(temp,": ",2)
'find the value between the 2 colons. This will give us user input
Dim content, backup As String
content = Strright(emailbody,": ")
backup = content
content = Strleft(content,":")
content = Strleft(content,(Chr(13)+Chr(10)+Chr(13)+Chr(10))) 'Go up 2 lines
'if there are 2 endlines in a row then it is a blank line
If Len(Strleft(content,(Chr(13)+Chr(10)+Chr(13)))) > 1 Then
temp3 = Strtoken(temp,": ",2)
temp3=content
Else
'Check again if this is the last token
If Len(content) <1 Then
Else
temp3 = Strleftback(Strtoken(temp,": ",2),Chr(13))
temp3=content
End If
End If
' If temp2="howattofits" Then
' Messagebox "value of TEMP2= " +Strtoken(temp,": ",2) , 0, "STOP"
' End If
' temp3=content
' temp3 = Strleftback(temp3,Chr(13))
' newemailbody = Strright(emailbody,Chr(13))
Loop Until (temp3=Null Or i>135)
doc.processed = "yes"
Call doc.Save(True,True)
Call doc2.save(True,True)
'Notify selected people of new AWARE application
Dim doc18 As NotesDocument
Dim rtitem As NotesRichTextItem
Set doc18 = New NotesDocument( db )
Set rtitem = New NotesRichTextItem( doc18, "Body" )
doc18.Form = "Memo2"
doc18.Subject = "New Advantage Partner Application"
rtitem.appendText("Please take a look at new application for AWARE Partner received from ATTO Website")
rtitem.addnewline(3)
rtitem.appendText("Click link to open")
rtitem.addnewline(2)
Dim recipients(1) As String
recipients(0) = "correct email"
Call rtitem.appendDocLink(doc2, db.Title)
Call doc18.Send( True, recipients)
End If
Set doc2 = dc.GetNextDocument(doc)
Set doc = doc2
Loop Until (doc Is Nothing)
End Sub