Hi,
I am new to domino and still fight to win LotusScript although the logic of its workflow is understandable (So I was thinking)
Anyway. I have a webform that gets filled in by registered webusers (Without a mailbox). In this form they fill a name and email of another person that is not registered.
When they submit this form, it should send a mail to the given mailbox on the form by the server as for instance from the admin@domain.xxx mailbox, with a simple text message.
I used a sullotion to try and solve my problem and got the following error,,, (NOW I AM STUCK).
Please look at my code and tell me what I am doing wrong!
My Code:
Sub Initialize
Dim session As New NotesSession
Set newnote = New NotesDocument(db)<----(Error)
newnote.Subject = "Subject: " & doc.YourSubjectField(0)
newnote.From = "admin@domain.xxx"
newnote.SendTo = "whomever@something.com"
newnote.CopyTo = "copyto@something.com"
newnote.Form = "Memo"
Set rtItem = New NotesRichTextItem(newnote , "Body" )
Set style = session.CreateRichTextStyle
style.Bold=True
Call rtitem.AppendStyle(style)
Call rtItem.AppendText(doc.YourFieldInBold(0))
style.Bold=False
Call rtitem.AppendStyle(style)
Call rtItem.APPENDTEXT("Dear " & director & " " + surname & ", " )
Call rtItem.ADDNEWLINE(2)
Call rtItem.AppendText(" More text, whatever you want.")
Call newnote.Send(False)
End Sub
The Error: Initialize: 3: type mismatch on: DB
Software/Hardware used:
ASKED:
July 27, 2006 6:01 PM
UPDATED:
July 28, 2006 11:39 AM
Change your code as below:
Sub Initialize
Dim session As New NotesSession
Dim db as NotesDatabase ‘new line
set db = session.CurrentDatabase ‘new line, if you needed
‘a db other than current use methods GetDatabase(“dbname”)
Set newnote = New NotesDocument(db)
when you fix the errors as suggested in reply 1 and 2, you will end up with the problem, that you can’t change the sender of the mail. domino will set it to the agent’s signer.
See http://www-10.lotus.com/ldd/46dom.nsf/7e6c7e584a76331b85256a46006f083e/574c99ccb345839185256976004e811e?OpenDocument
and
http://www-128.ibm.com/developerworks/lotus/library/ls-Troubleshooting_agents_ND5_6/
(How can I change the apparent sender of agent generated mail?)
Try declaring your variables and setting the db object before use.
Sub Initialize
Dim session As New NotesSession
Dim db as NotesDatabase
Dim newnote as NotesDocument
Set db = session.CurrentDatabase
Set newnote = New NotesDocument(db)
newnote.Subject = “Subject: ” & doc.YourSubjectField(0)
‘…. and so on …