I have a lotus-script agent which runs as Web User since I need to know who the current user is and process information accordingly. The problem is that when sending a email in this agent the From email address shows the web user email address rather than the one I have defined. I am setting the following fields before I send the email (as mime):
mailDoc.Form = "Memo"
mailDoc.Subject = strSubject
mailDoc.InetSendTo = strFrom
mailDoc.PostedDate = Now
mailDoc.Principal = strFrom
mailDoc.FROM = strFrom
mailDoc.INETFROM = strFrom
mailDoc.~INetPrincipal = strFrom
mailDoc.ReplyTo = strFrom
mailDoc.SendFrom = strFrom
mailDoc.SentBy = strFrom
mailDoc.altFrom = strFrom
mailDoc.tmpDisplaySentBy = strFrom
mailDoc.DisplaySent = strFrom
mailDoc.ToShow = strFrom
mailDoc.SendTo = strSendTo
But still the From address is shown as the web user's address. What am I missing here? Any help would be really appreciated.
Actually searching through the forums I found a solution to this age old problem (http://www-10.lotus.com/ldd/nd6forum.nsf/0/13706561dc7d693f852570af0062fcec?OpenDocument):
Principle = "[email protected]"
maildoc.Form = "Memo"
' Principal overrides From
' Must be formatted as below and must include the domain @xyz.com
' Format should equal: "From User" <[email protected]@DOMAIN>
maildoc.Principal = |"Customer Service" <| + Principle + |@xyz.com>|
maildoc.From = Principle
maildoc.AltFrom = Principle
maildoc.SendFrom = Principle
maildoc.INetFrom = Principle
maildoc.tmpDisplaySentBy = Principle
maildoc.tmpDisplayFrom_Preview = Principle
maildoc.DisplaySent = Principle
Hope this helps other people - this has been a issue for me for a very long time!!
The security in Lotus Notes won't let you override the actual sender information via LotusScript. The only way to control it is to set the Run on behalf of property of the agent to the user from which the email should appear to come. However, you have to set that using the designer and you can't change it at runtime.
It's hard to tell from your question, but if you've tried that and found that the web user setting is overriding the 'on behalf of' setting, you might try splitting the creation of the email into a second agent, and then having that second agent run not as a web user.
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With