Skip to main content
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 4 and 5 Forum

Notes/Domino 4 and 5 Forum

developerWorks

  

Sign in to participate

RE: Webcentric view of changing apparent sender for email
Mark I Thompson 6.Aug.01 04:05 PM a Web browser
Domino Designer -- Agents All Releases All Platforms


Thank you Julie Kadashevich for all your information on this topic. I'm posting
this because it would have helped me in figuring out how to get the email agents
to work as I wanted.

First, the PRINCIPAL field replaces the use of the FROM field.

We have a large number of email agents and none of the email is being sent to
Notes
users. However, most of the email recipients have an entry in our NAB and are
assigned an SMTP email address there. Also I did not test this with
canonicalized
names, because that is not relevant to environment.

I had no difficulties with the SendTo field so I won't address that here.

I did have issues with both the FROM and the REPLYTO fields. Below is what I
was
able to accomplish. I wanted the FROM field to show a name, and have an email
address
behind it. This would typically be coded "My Name <myname@mydomain.com>" I
was not
able to achieve this. So instead I compromised by displaying the persons real
email
address, instead of their name suffixed with a domain name.

In the table below Type indicates the purpose of the text being passed to the
PRINCIPAL
field. Entry is the actual text, typically from a field called EmailFrom in
our case.

FROM field:
TABLE BORDER=1 CELLPADDING=3>
<TR>
<TH>Type</TH><TH>Example Entry</TH><TH>Example Displays on Email</TH>
</TR>
<TR>
<TD>Mail-in
DB</TD><TD>RegistrationEmail</TD><TD>RegistrationEmail@ourdomain.com</TD>
</TR><TR>
<TD>Lotus Group</TD><TD>Article
Authors</TD><TD>Article_Authors@ourdomain.com</TD>
</TR><TR>
<TD>Fullname</TD><TD>Tory Volmert</TD><TD>tv@anotherdomain.com <I>(value on the
Person doc)</I></TD>
</TR><TR>
<TD>email</TD><TD>me@myisp.com</TD><TD>me@myisp.com</TD>
</TR><TR>
<TD>Bogus text</TD><TD>Auto Email</TD><TD>Auto_Email@ourdomain.com</TD>
</TR>
</TABLE>
<! Above table For Notes Readers of this document
Type Example Entry Example Displays on Email
-------- --------------- ---------------------------
Mail-in DB RegistrationEmail RegistrationEmail@ourdomain.com
Lotus Group Article Authors Article_Authors@ourdomain.com
Fullname Tory Volmert tv@anotherdomain.com (value on the
Person doc)
email me@myisp.com me@myisp.com
Bogus text Auto Email Auto_Email@ourdomain.com
-->]

For each of these I simply copied the text into the PRINCIPAL field on my
"memo" document,
except for text that had @signs in them. In those cases I appended
"@NotesDomain" onto
the text.

For the REPLYTO I wanted the same results. The "@NotesDomain" text never is
needed on the
REPLYTO field.

To get these to work properly I changed my process to lookup the email address
from the NAB.

So to put it all together here is an example WebQuerySave agent:


!-- For Notes Readers
Declarations
Dim stdEmailSendTo, stdEmailCopyTo, stdEmailBlindCopyTo, stdEmailBody
As Variant


Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
On Error Goto ErrorHandler

Set doc=session.DocumentContext
Set db = session.CurrentDatabase

Call SetEmailFrom( doc.From(0), doc.ReplyTo(0) )
stdEmailSubject = doc.EmailSubject(0)
stdEmailSendTo = doc.GetItemValue( "SendTo" )
stdEmailCopyTo = doc.GetItemValue( "CopyTo" )
stdEmailBlindCopyTo = doc.GetItemValue( "BlindCopyTo" )
stdEmailBody = doc.emailbody

Call SendEmail(True)
End Sub

Sub SendEmail( SaveEmail As Variant )
Dim session As New NotesSession
Dim db As NotesDatabase
Dim email As NotesDocument

Set db = session.CurrentDatabase

Set email = New NotesDocument ( db )
email.Form = "Memo"
email.Subject = stdEmailSubject
email.Principal = stdEmailFrom
email.ReplyTo = stdEmailReplyTo
email.SendTo = stdEmailSendTo
email.CopyTo = stdEmailCopyTo
email.BlindCopyTo = stdEmailBlindCopyTo

Call email.send (False)
If SaveEmail Then
Call email.save (False, True)
End If
End Sub

Sub SetEmailFrom( eFrom As String, ReplyTo As String)
Dim emailaddress As String

If Instr(eFrom, "@") > 0 Then
stdEmailFrom = eFrom & "@NotesDomain"
Else
'look up email address on nab, if not found just copy FROM name
emailaddress = GetEmailAddress( eFrom, "names.nsf")
If emailaddress = eFrom Then
stdEmailFrom = eFrom
Else
stdEmailFrom = emailaddress & "@NotesDomain"
End If
End If

If Instr(ReplyTo, "@") > 0 Then
stdEmailReplyTo = ReplyTo
Else
'look up email address on nab, if not found just copy From
name to
emailaddress = GetEmailAddress( ReplyTo, NAB1)
If emailaddress = ReplyTo Then
stdEmailReplyTo = ReplyTo
Else
stdEmailReplyTo = emailaddress
End If
End If
End Sub

Function GetEmailAddress( EmailName As String, NAB As String) As String
Dim session As New NotesSession
Dim db As NotesDatabase
Dim NABdb As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument

On Error Goto ErrorHandler

GetEmailAddress = EmailName

Set db = session.CurrentDatabase
Set NABdb = New NotesDatabase( db.server, NAB )
Set view = NABdb.GetView( "($VIMPeople)" )
Set doc = view.GetDocumentbykey(EmailName)

If Not doc Is Nothing Then
GetEmailAddress = doc.MailAddress(0)
End If
Exit Function

ErrorHandler:
Exit Function
End Function
-->
Declarations<BR>
Dim stdEmailSendTo, stdEmailCopyTo, stdEmailBlindCopyTo, stdEmailBody As
Variant<BR>
<P>
Sub Initialize<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim session As New NotesSession<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim db As NotesDatabase<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim doc As NotesDocument<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;On Error Goto ErrorHandler <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set doc=session.DocumentContext<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set db = session.CurrentDatabase<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Call SetEmailFrom( doc.From(0), doc.ReplyTo(0)
) <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stdEmailSubject = doc.EmailSubject(0) <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stdEmailSendTo = doc.GetItemValue( "SendTo" )<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stdEmailCopyTo = doc.GetItemValue( "CopyTo" )<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stdEmailBlindCopyTo = doc.GetItemValue(
"BlindCopyTo" )<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stdEmailBody = doc.emailbody<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Call SendEmail(True)<BR>
End Sub<BR>
<P>
Sub SendEmail( SaveEmail As Variant )<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim session As New NotesSession<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim db As NotesDatabase<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim email As NotesDocument<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set db = session.CurrentDatabase<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set email = New NotesDocument ( db )<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;email.Form = "Memo"<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;email.Subject = stdEmailSubject<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;email.Principal = stdEmailFrom<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;email.ReplyTo = stdEmailReplyTo<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;email.SendTo = stdEmailSendTo<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;email.CopyTo = stdEmailCopyTo<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;email.BlindCopyTo = stdEmailBlindCopyTo<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Call email.send (False)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If SaveEmail Then<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Call email.save
(False, True)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End If<BR>
End Sub<BR>
<P>
Sub SetEmailFrom( eFrom As String, ReplyTo As String)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim emailaddress As String<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If Instr(eFrom, "@") > 0 Then<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stdEmailFrom =
eFrom & "@NotesDomain"<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Else<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'look up email
address on nab, if not found just copy FROM name <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;emailaddress =
GetEmailAddress( eFrom, "names.nsf")<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If emailaddress =
eFrom Then<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;stdEmailFrom = eFrom<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Else<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;stdEmailFrom = emailaddress & "@NotesDomain"<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End If<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End If<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If Instr(ReplyTo, "@") > 0 Then<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stdEmailReplyTo =
ReplyTo<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Else<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'look up email
address on nab, if not found just copy From name to <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;emailaddress =
GetEmailAddress( ReplyTo, NAB1)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If emailaddress =
ReplyTo Then<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;stdEmailReplyTo = ReplyTo<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Else<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;stdEmailReplyTo = emailaddress<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End If<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End If<BR>
End Sub<BR>
<P>
Function GetEmailAddress( EmailName As String, NAB As String) As String<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim session As New NotesSession<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim db As NotesDatabase<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim NABdb As NotesDatabase<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim view As NotesView<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dim doc As NotesDocument<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;On Error Goto ErrorHandler<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GetEmailAddress = EmailName<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set db = session.CurrentDatabase<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set NABdb = New NotesDatabase( db.server, NAB
)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set view = NABdb.GetView( "($VIMPeople)" )<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set doc = view.GetDocumentbykey(EmailName)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If Not doc Is Nothing Then<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GetEmailAddress =
doc.MailAddress(0)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End If<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Exit Function<BR>
<BR>
ErrorHandler:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Exit Function<BR>
End Function<BR>
<!>]



Lotus Notes/Domino Agent FAQ update... (Julie Kadashevi... 12.Oct.00)
. . RE: Run as web user seems not work,... (Yuan Jia 23.Nov.00)
. . RE: [Julie... Add to your list?] SO... (William Hayward... 19.Dec.00)
. . RE: Can the autoprocess functionali... (Jagmeet Lamba 17.Jan.01)
. . RE: Agent output file on network dr... (Arul K Paulus-R... 23.Jan.01)
. . . . RE: Agent output file on network dr... (Leo Green 23.Jan.01)
. . . . . . RE: Agent output file on network dr... (Arul K Paulus-R... 23.Jan.01)
. . . . . . . . RE: Agent output file on network dr... (Hans Fredrik No... 24.Jan.01)
. . . . . . . . . . RE: Resolved: Agent output file on ... (Arul K Paulus-R... 24.Jan.01)
. . . . . . . . . . . . RE: Resolved: Agent output file on ... (Horst Pozdena 22.Feb.02)
. . . . . . . . . . . . . . RE: Resolved: Agent output file on ... (Horst Pozdena 22.Feb.02)
. . . . . . . . . . . . . . . . RE: Resolved: Agent output file on ... (Miguel A Navarr... 24.May.08)
. . . . . . . . . . . . RE: Resolved: Agent output file on ... (scott noebel 22.May.02)
. . RE: How to manage agent scheduler ?... (Evandro Freitas... 8.May.01)
. . RE: Agents not runing on local . (Juan Eduardo Lo... 22.May.01)
. . RE: Updating of the content of Juli... (Jerry Manner 31.Jul.01)
. . RE: Webcentric view of changing app... (Mark I Thompson... 6.Aug.01)
. . . . RE: Webcentric view of changing app... (Mark I Thompson... 6.Aug.01)
. . RE: Potential Work-Around to handel... (John Battista 9.Aug.01)
. . FAQ proposal: Anti SPAM tecniques (Simone Chemelli... 23.Aug.01)
. . Agent runs but does not send mail (David E Rackley... 30.Aug.01)
. . Scheduled Agent with ODBC bombs (Kenneth Axi 25.Sep.01)
. . Where can I find maxperformancedomi... (Ingo Beyer 6.Aug.02)
. . . . RE: Where can I find maxperformance... (Andrew P Tasi 7.Aug.02)
. . RE: Agent FAQ updated 10/07/02 [ pl... (Bill C Buhl 12.Dec.02)
. . Agent FAQ (Walter Mobach 6.May.03)
. . Recycle() clarifications (Douglas S Gray 15.Jul.04)
. . RE: Agent FAQ updated 1/9/03 (Jeff Harris 25.Feb.04)
. . Question: New ND6 AMGR Run and Canc... (Usha A Dewastha... 20.Jul.05)
. . . . RE: Question: New ND6 AMGR Run and ... (Julie Kadashevi... 10.Aug.05)
. . . . . . Question: How do a scheduled agent ... (Hung D Tran 9.Jan.06)
. . RE: Lotus Notes/Domino Agent FAQ up... (Anthony T Kendr... 29.Aug.06)
. . . . RE: Lotus Notes/Domino Agent FAQ up... (Terry Boyd 21.Sep.06)
. . "Minimizing delays in the Agent Man... (Gustavo A Rojas... 1.Feb.07)
. . RE: Lotus Notes/Domino Agent FAQ up... (Natalie Kashlin... 26.Dec.08)






  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Author
Category
Platform
Release
Advanced search

 Sign In or Register
Sign in
Forgot your password?
Forgot your user name?
Create new registration

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds

 Resources
Forum use and etiquette
Native Notes Access
Web site Feedback

  Lotus Support
Lotus Support
Product support pages index
Search knowledge base (Technotes)
Search support downloads
Lotus Support RSS

 Wikis
IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
Notes/Domino 4 and 5
IBM Connections
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
IBM SmartCloud Meetings
IBM Web Content Manager
Lotus Domino Document Manager
Lotus e-learning
Lotus Enterprise Integration
Lotus Expeditor
Lotus Protector
Lotus Quickr
Lotus SmartSuite
Lotus Symphony
Lotus Symphony Developer Toolkit Support
Lotus Workflow