@mailsend sending multiple emails in scheduled agent

Posted on 2007-12-06
Last Modified: 2013-12-18

I am trying to use @mailsend in a scheduled agent.
I am working accept for one problem...

The @mailsend is sending an email for each document. I only want it to send 1 email!

Basically I am using @elements and if the view contains more than 100 documents based on certain criteria a single email should be sent.

Currently if 48 documents match this criteria, 48 emails are sent.

How can I ensure that only 1 email is sent.

Question by:shuboarder
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
LVL 22

Expert Comment

ID: 20422156
You will need to switch to LotusScript to accomplish this.  Is that OK?
LVL 21

Author Comment

ID: 20422188
That's fine, but I wouldn't know how to write it in LotusScript....
LVL 22

Expert Comment

ID: 20422394
Post your agent code, and I'll see what I can do.
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 21

Author Comment

ID: 20423903
Hi Bill,

very kind of you. Are you sure we can't do something clever with the formula below?

body := "this database needs attention etc."

@MailSend("";"";"";"Database Alert!";"";body;[PriorityHigh]);

LVL 19

Expert Comment

ID: 20425642
check the agent properties settings. It should run Scheduled and run on none.
LVL 21

Author Comment

ID: 20426248
Hi madheeswar,

this would make sense, but you can't have a scheduled agent with a target of "none" or can you?
LVL 21

Author Comment

ID: 20434785
I don't seem to be able to run with a target of none unless I select to run on event.
LVL 19

Accepted Solution

madheeswar earned 500 total points
ID: 20440332 was my mistake.
For Scheduled agents you cannot have none.
Since it's my fault, use this code....Tested and it is working. Make it a Scheduled agent and run on all documents. Provide your email in tmpname..

Sub Initialize
	Dim ss As New NotesSession 
	Dim db As NotesDatabase 
	'Dim view As notesview
	'Dim dc As NotesDocumentCollection 
	'Dim doc As NotesDocument 
	Dim maildoc As NotesDocument 
	Set db=ss.CurrentDatabase 
	tmptotal = Evaluate(|@Elements(@DbColumn("";"";"List";1))|)
	If Isempty(tmptotal) Or tmptotal(0) < 100 Or tmptotal(0)="" Then Exit Sub
	'Send email:
	Set maildoc = New NotesDocument( db )
	maildoc.Form = "Memo"
	maildoc.Subject = "Reminder: Please Review New Application"
	Set Body=New NotesRichTextItem(maildoc,"Body")
	message="Please Review the New Application"
	Call Body.AppendText(message)
	Call Body.AddNewLine(2)
	tmpname = "Your Mail addess"
	Call maildoc.Send( True, tmpname ) 
End Sub

Open in new window

LVL 21

Author Closing Comment

ID: 31416036
Thanks Madheeswar, this seems to be working well!

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit If you want to manage em…

734 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