This Lotus developer was trying to come up with a clever solution to forward incoming e-mails to recipients' text-enabled mobile phones. Instead he ended up setting off a mail bomb on himself and his ASP. The following story is a good example of how a clever idea can blow up in your face, or your inbox.
I was doing some development work to create an agent that would run when a new mail arrives and send a summary to the mobile phone text service (SMS). I had set the agent to run on new mail received but for each mail received it sent summaries of all e-mails in my DB!
Anyway the poor ASP that was forwarding my SMSs had a limit of 100 per day so any subsequent SMS was rejected with an e-mail, which in turn triggered another flood of e-mails, which in turn resulted in a stream of rejections, which in turn... well you get the picture.
I left this running overnight!
The result: Some 40,000 e-mails outbound with a similar number inbound and a very cranky ASP. I was very red-faced the next morning to return to the office with a lot of phone messages from ASP. It was an easy fix, but now I have lifetime ban from the ASP. I have fixed the agent (below), which looks in the calendar profile for details of SMS e-mail addresses. The agent is set to run "AfterNew mail Has Arrived" on newly received mail documents.
Regards,
George Savory
Code
'Options
Option Public
Option Declare
Sub Initialize
Dim session As New NotesSession
Dim dbCurrent As NotesDatabase
Dim collUnprocessed As NotesDocumentCollection
Dim docCurrent As NotesDocument
Dim itemBody As NotesItem
Dim strPriority As String, strImportance As String
Dim varBody As Variant
Dim strSendTo As String
Dim m_calprofile As notesdocument
Dim sendsms As String
Set dbCurrent = session.CurrentDatabase
Set m_calprofile = dbCurrent.GetProfileDocument("CalendarProfile")
strSendTo = M_calprofile.SMSAddress(0) 'Celluar pager address
sendsms = M_calprofile.SMSOwner(0)
If sendsms = "Yes" Then 'I want to be notified
If (dbCurrent Is Nothing) Then
'Nothing to Process
Else
Set collUnprocessed = dbCurrent.UnprocessedDocuments
If collUnprocessed.Count < 1 Then
Else
Set docCurrent = collUnprocessed.GetFirstDocument
If (docCurrent Is Nothing) Then
'No handle for Current Doc
Else
Do
strPriority = docCurrent.DeliveryPriority(0)
strImportance = docCurrent.Importance(0)
If ((docCurrent.Form(0) = "Memo") And
(strPriority = "H" Or strImportance = "1")) Then
'Need to create new memo & send to pager.
Dim docPagerMemo As New
NotesDocument(dbCurrent)
Dim varFrom As Variant, strSubject As
String, strBodyText As String
docPagerMemo.SendTo = strSendTo
varFrom = Evaluate({@Name([CN]; From)},
docCurrent)
strSubject = docCurrent.Subject(0)
Set itemBody = docCurrent.GetFirstItem
("Body")
If (itemBody Is Nothing) Then
'Body can not be read
docPagerMemo.Body = "Text can not
be read. Check your email. | From: " & varFrom
Else
'If Body can be read, return only 200
characters
strBodyText = "Fr: " & varFrom(0)
& " : " & Left(itemBody.Abstract(1000,1,0), 200)
docPagerMemo.Subject = strSubject
docPagerMemo.Body = strBodyText
docpagermemo.inetfrom
= "b2b<b ((Content component not found.)) .b>"
End If
Call docPagerMemo.Send(False)
Call
session.UpdateProcessedDoc(docCurrent)
End If
Set docCurrent =
collUnprocessed.GetNextDocument(docCurrent)
Loop Until (docCurrent Is Nothing)
End If
End If
End If
Else
'No I dont want to be notified
Exit Sub
End If
End Sub
'End of Agent
Do you have your own blooper? Send it in and claim your fame.
Every story in our bloopers series comes to us directly from a SearchDomino.com administrator, developer or consultant. For obvious reasons, some contributors -- including this tale's author -- choose to remain anonymous.
MORE ON THIS TOPIC:
Read all SearchDomino.com's true bloopers.
View our Best Web Links on Domino/Notes administration.