I recently had the need to send a response email from an account that was set for "no_reply" address. I wanted the sender to get a response, but I didn't want responses to that response to come back to me. Here is the code that I ended up with. Works well for internet email. Enjoy and put this to good use!
%REM
Description: This agent will send a response to all email sent to an account
Set this agent to trigger before new mail arrives
%END REM
Option Public
Option Declare
Sub Initialize
' Sends a response email to all mail received
'
Dim ses As New NotesSession
Dim currentDoc As NotesDocument
Dim db As NotesDatabase
Dim maildoc As NotesDocument
Dim msg1, msg2, msg3, msg4 As Variant
Dim rtitem As NotesRichTextItem
Dim Principle As String
Set db = ses.currentDataBase
Set maildoc = New NotesDocument(db)
Set currentDoc = ses.documentContext
maildoc.Form = "Memo"
Principle = "no_reply@some_domain.com"
maildoc.Principal = |"Do Not Respond" <| + Principle + |@some_domain.com>|
maildoc.From = Principle
maildoc.AltFrom = Principle
maildoc.SendFrom = Principle
maildoc.INetFrom = Principle
maildoc.tmpDisplaySentBy = Principle
maildoc.tmpDisplayFrom_Preview = Principle
maildoc.DisplaySent = Principle
maildoc.SendTo = currentDoc.GetItemValue("From")(0)
maildoc.Subject = "New Contact Information"
msg1 = "The owner of this process has changed. Please contact:" & Chr(13)
msg2 = "person1@some_domain.com or person2@some_domain.com"
msg3 = " for any future correspondence." & Chr(13)& Chr(13)
msg4 = "Thank You" & Chr(13) & Chr(13)
Set rtitem = maildoc.CreateRichTextItem( "Body" )
Call rtitem.AppendText(msg1 & msg2 & msg3 & msg4)
Call maildoc.send(False)
End Sub
If it's tech related...I'll post it here. Lotus Notes/Domino, AS400 or iSeries, PC's, PDA's, iPods, Android -- Whatever.
Tuesday, September 11, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment