Today I had to write a script to run in a Lotus Notes database that generates an auto reply email when a form is submitted. The email is sent to the email address specified in the "Email" field on the form. This script is relatively simple, written in LotusScript and works a treat. One tricky thing that I had to work out was to be able to send the email from a specific email address, as setting "From" field did not work. When the email hit the Domino server its value was set Anonymous. This causes problems as allot of spam filters reject the email, including Google's, which was what I was originally testing with. I have commented out the "ReplyTo" as even without this set, when you click reply in your Inbox the email still replies to info@munchtechnologies.com.au. If someone out there knows why this is I would be interested.
Sub Initialize
Dim Session As New NotesSession
Dim DocWeb As NotesDocument
Dim DBCur As NotesDatabase
Dim tmpEmail As String
Dim EmailTo As String
Dim rtitem As NotesRichTextItem
Set DBCur = Session.CurrentDatabase
Set DocWeb = Session.DocumentContext
tmpEmail = DocWeb.GetFirstItem("Email").Text
Set WorkApps = New NotesDocument(DBCur)
Set rtitem = New NotesRichTextItem( WorkApps , "Body")
WorkApps.SendTo = tmpEmail
WorkApps.Principal = "info@munchtechnologies.com.au"
WorkApps.INetFrom = "info@munchtechnologies.com.au"
WorkApps.DisplaySent = "info@munchtechnologies.com.au"
'WorkApps.ReplyTo = "info@munchtechnologies.com.au"
'WorkApps.From = "info@munchtechnologies.com.au"
WorkApps.Form = "Memo"
WorkApps.Subject = "Job Application Received - Munch Technologies"
Call rtitem.appendtext("This email is to let you know that we have received your job application.")
Call rtitem.AddNewline(2)
Call rtitem.appendtext("If you are required for an interview, a member of the Munch Technologies Management Team will contact you directly.")
Call rtitem.AddNewline(2)
Call rtitem.appendtext("Thank you for taking the time to complete the application form. Your application will be kept on file for 3 months.")
Call rtitem.AddNewline(2)
Call rtitem.appendtext("For any further information please contact us directly through the contact us section at http://www.munchtechnologies.com.au")
Call rtitem.AddNewline(2)
WorkApps.send True
End Sub
Hope you Lotus Notes heads out there find this useful.
Hi there,
ReplyDeleteI was wondering if you ever cam right with the script?? I need something like this asap..
please let me know @ riaan.louw@pttransformers.co.za
Hi Not sure you check this still, but principal is the value used to calculate the reply from address.
ReplyDeleteDan...
thank you dan..
ReplyDeletecan any of u please help me how to use a mail stationary for sending mails in lotus notes by writing a vbscript? i am automating mail sending via lotus notes ans I just need the piece of code to use a specefic stationary.
ReplyDeletepls mail me the solution at nabo_sarkar@yahoo.co.in
Thanks a lot
ehh. really like this thread ))
ReplyDeleteplease tell me, how to make an notify at a specified time (step to setup, souce code, example...), such as send mail or alarm message box with lotus script. Thanks a lot.
ReplyDeleteThat's very convenient. The auto reply email script can definitely help in a lot of ways. Thanks for sharing.
ReplyDeleteweb design Perth
reply to Anonymous - just make the agent a scheduled agent so that it runs at that time? Did i answer your question or do you mean something else?
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDelete