Agent needed to create a single mail with attachment from the personal n&a

Posted on 2003-10-28
Last Modified: 2013-12-18

i bought a sms service.
sending a mail to the sms provider , the provider will send out this mail as a sms.

the format of this mail is not so nice.

i tried it manaull, it works.
now i look for a smarter solution.

i'm in my personal n&a on a persons record.
now i want to press a button ...or something else...and this mail is created automatically.

mail format:
- the subject needed to be allways the same predefined text.
- so use e.g.  yxcvb123  as  the subject
- the address / sendto is also allways the same, so please use e.g. ""
- attachment:
   an attachment is needed, content as plain text
   name of the attachment:  beispiel.csv

- content of the attachment

49           = country code  (will be allways the same = 49)
174         = area code
2893611 = phone number
Martin;Miller;  = senders name, allways the same = Martin;Miller;

my idea is that the agent should look at the document field:  CellPhoneNumber
and takes the needed information out of this filed.
if you look at this filed, you see 0174-2893611   in the persons record.

Question by:hreinart
  • 3
  • 2
  • 2
  • +1
LVL 46

Expert Comment

by:Sjef Bosman
ID: 9635443
You want some hints, or the full solution? I assume you didn't start developing this yet, but the working solution is far from trivial. The hints:
- I'd use LotusScript to do this
- most of the commands to be used are pretty straightforward
- create a NotesDocument to store the mail temporarily
- to create an attachment you need to have a temp. directory
- use Open and Print to write to that file
- create the necessary fields, including a RichText Body field
- attach the file, and unlink it
- send the mail out

It's a substantial piece of coding, for which I haven't got the time...

Viel Erfolg!

Author Comment

ID: 9635488
i want the full solution
LVL 24

Expert Comment

ID: 9636046
Try this ready made solution and make necessary changes to fit your need

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.


Author Comment

ID: 9642508
did you check if attachments are created, too? the way i need it?
LVL 24

Expert Comment

ID: 9642556
SMS is simple text msg mail. I don't think that they can handle attachments ? Do they ? I never used SMS !
LVL 46

Expert Comment

by:Sjef Bosman
ID: 9642687
Sounds to me you need a job done, not "some" assistance. I suppose we'd all love to send you a bill for a full solution, but that's way beyond the scope of my (unpaid) activities in this site anyway.

Maybe someone else...

Author Comment

ID: 9643235
HemanthaKumar: please read my needs in the question.   the attachment is needed, please read above, thanks

Accepted Solution

Jean Marie Geeraerts earned 125 total points
ID: 9694264
This agent isn't too complicate to write.

1) Create an agent and set the properties to
- Run 'From Action Menu'
- Run on 'Selected Documents'
- Run LotusScript

2) Select the people for which you want to send an SMS and then select the agent from the action menu

Here's the code for the agent:

Sub Initialize
      'first define fixed values, we define them in constans so they are easier to adjust afterwards
      Const COUNTRY_CODE = "49"
      Const SMS_SENDTO = ""
      Const SMS_SUBJECT = "fixed subject"
      Const SMS_SENDER_FIRST_NAME = "Martin"
      Const SMS_SENDER_LAST_NAME = "Miller"
      Const TMP_FILE = "c:\temp\beispiel.csv"
      'initialize local variables
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim dc As NotesDocumentCollection
      Dim docPerson As NotesDocument
      Dim docMail As NotesDocument
      Dim strZone As String 'holds the location number and country code
      Dim strPhone As String 'holds the phone number
      Dim strCellPhone As String 'used to hold the full phone number from the person document
      Dim FileNum As Integer
      Dim rtBody As NotesRichTextItem
      'get reference to the selected documents from the address book
      Set db = session.CurrentDatabase
      Set dc = db.UnprocessedDocuments
      'walk through all selected documents and create a mail per document
      If dc.Count = 0 Then Exit Sub
      Set docPerson = dc.GetFirstDocument
      Do While Not docPerson Is Nothing
            'get phone number
            strCellPhone = docPerson.CellPhoneNumber(0)
            strZone = Left$(strCellPhone, Instr(strCellPhone, "-")-1)
            strZone = COUNTRY_CODE & Right$(strZone, Len(strZone)-1)
            strPhone = Right$(strCellPhone, Len(strCellPhone) - Instr(strCellPhone, "-"))
            'write temporary file
            FileNum = Freefile
            Open TMP_FILE For Output As FileNum
            Print #FileNum, strZone & ";" & strPhone & ";" & SMS_SENDER_FIRST_NAME & ";" & SMS_SENDER_LAST_NAME & ";"
            Close FileNum
            'create mail and attach the file
            Set docMail = db.CreateDocument
            With docMail
                  .SendTo = SMS_SENDTO
                  .Subject = SMS_SUBJECT
                  'create the body field to hold the attachment
                  Set rtBody = .CreateRichTextItem("Body")
                  'attach the file as a regular attachment
                  Call rtBody.Embedobject(1454, "", TMP_FILE)
                  'send the mail
            End With
            Set docPerson = dc.GetNextDocument(docPerson)
End Sub

The agent supposes that the mobile number is always stored in the format you specified. No fancy translation implemented, so make sure the CellPhoneNumber is correct before you run the agent. I didn't include any validation checks.

If you run into any trouble, let me know.

Kind regards,

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

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…
  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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

813 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now