Send mail as admin@domain.xxx and not from server when webform submit

pts.
Tags:
Lotus Domino
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

Answer Wiki

Thanks. We'll let you know when a new response is added.

You need to declare and instantiante the db, newnote and doc variables. This will get you past the first error, Your code will then bomb on the line after the error unless you set doc = to something (like you did with the newnote, you must set the doc = to a notes document (like the current document) in order to get the value of the Subject field).

Good luck.

Dim session As New NotesSession
Dim db as NotesDatabase
DIm newnote as NotesDocument
Set db = s.CurrentDatabase
Set newnote = New NotesDocument(db)<—-(Error)
newnote.Subject = “Subject: ” & doc.YourSubjectField(0)

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Dpeabo
    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)
    0 pointsBadges:
    report
  • Markuskoller
    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?)
    0 pointsBadges:
    report
  • SlimDude
    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 ...
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following