Solved

how to send mail to default user - a custom role

Posted on 2004-04-26
8
253 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.

0
Comment
Question by:damoncwk
  • 3
  • 2
8 Comments
 
LVL 15

Accepted Solution

by:
Bozzie4 earned 63 total points
ID: 10917549
The easiest way to solve this, is not add people directly to your ACL, but put them in groups first, and assign the roles to the groups.  This has the added advantage, that you can give people the right to grant access to other people without giving them Manager access in your database (they only need to have Author access on the names.nsf, and listed in the Administrators field for the particular group).

Normally, I use a simple naming scheme, for instance <application name>_<role>_<general access> (create your own naming schemes as you see fit, of course).

For a group in the AnApplication application, that has the Revisor role, and has Author access in the database, I would name it
AnApplication_Revisor_Author

Users can then mail this group, to reach everybody who has the Revisor role


Other solutions require writing a lotusscript, to examine all entries in the ACL, and sending the emails based on those results....

cheers,

Tom
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 10921471
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
0
 

Author Comment

by:damoncwk
ID: 10924165
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.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 31

Assisted Solution

by:qwaletee
qwaletee earned 62 total points
ID: 10933491
the reasib I had the FIELD SendTo... stuff is as follows:

As I process the ACL, I build a string called ADDR that contains multiple names separated with commas.  It looks sort of like a regular Notes memo recipient list:
damoncwk,bozzie4,qwaletee

But ADDR, is only a LotusScript variable, I need it on the form, so I use:

msg.replaceItemValue "SendTo" , addr

Now, here comes a small problem.  Even though in a memo, it looks like the names are a single string separated by commas, it doesn't really work this way.  they are multiple separate values, known as a list (simialr to arrays), and the list DISPLAYS its multiple values separate dby commas.  Here, we are actually using a single string, not a list field, and Notes will think it is one e-Mail address that has two commas in the middle, not three separate e-mail addresses.

So, I need to find a way to break the string at the commas into a list.  The @Explode formula does that.

You tried to add an @Explode formula for CopyTo.  But yo weren't aware of the mechanisc of why I did the explode.  Since I assigned SendTo to start with, the @Explode had a value to work on.  You didn't assign a CopyTo value (via ReplaceItemValue), so there was a blank string.  The fact that YOUR form contained a CopyTo field is irrelevant because I am not sending your form's data.  I am not even looking at it.

So, you need something like:

msg.replaceItemValue "CopyTo" , "some address"

And if the value you put in is a single address, you won't need an @Explode for it either.  Only bother with @Explode if you put in something like:
msg.replaceItemValue "CopyTo" , "some address,another address"
0
 

Author Comment

by:damoncwk
ID: 10937615
Hi qwaletee,
still digesting your reply.
And how can I include a doclink in the msg?
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 11417646
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

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question