We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

how to send mail to default user - a custom role

damoncwk
damoncwk asked
on
Medium Priority
288 Views
Last Modified: 2013-12-18
Hi all,
Several custom roles are created in the ACL.
Now we would like to email to several default
such roles in our app. How should it be be done
so that this is possible?
thanks.

Comment
Watch Question

IT Architect
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Commented:
Dim s as new notesSession
Dim db as notesDatabase
Set db = s.currentDatabase
Dim addr as string
Dim acl as notesAcl
Set acl = db.acl
Dim entry as notesAclEntry
Set entry = acl.getFirstEntry
Do Until entry is nothing
    if entry.isRoleEnabled(  "[" & NAME_OF_ROLE & "]"   ) then
        addr = addr & entry.name & ","
    end if
    Set entry = acl.getNextEntry(entry)
Loop

Dim msg as notesDocument
Set msg = db.createDocument
msg.replaceItemValue "Form" , "Memo"
msg.replaceItemValue "Subject" , "something"
msg.replaceItemValue "Body" , "main message" 'you might want to switch to rich text
msg.replaceItemValue "SendTo" , addr
Dim filler
filler = Evaluate(|
FIELD SendTo := @Explode(SendTo;",");
CONTNUE
|,msg)
msg.send false

Author

Commented:
qwaletee,
for your script i tried to add the following
FIELD CopyTo :=@Explode(CopyTo;",");
in order to send cc mail.
However the person specified in the form field "CopyTo" did
not receive any mail after this.

I can mail to the cc mail if I use formula however for your script
I cannot accomplish this part in addition to your comment. Thanks.
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
Hi qwaletee,
still digesting your reply.
And how can I include a doclink in the msg?

Commented:
This is abandoned.  However, I noticed that I never answered the "extra credit" question at the end, so here goes...

Replace:
msg.replaceItemValue "Body" , "main message" 'you might want to switch to rich text

With:
Dim doc as notesDocument
Set doc = s.documentContext
'just an example... you need to set doc to some Notes document, you might also try dim ws as new notesUiWorkspace : Set doc = ws.currentDocument.document
Dim body as new notesRichTextItem ( msg )
msg.appendText "main message" 'you might want to switch to rich text
msg.addNewLine 2
msg.appendDocLink doc "Link text" 'replace this too

Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.