Solved

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

Posted on 2003-10-28
8
201 Views
Last Modified: 2013-12-18
hi,

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

problem:
the format of this mail is not so nice.

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

idea:
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. "john@sms.com"
- attachment:
   an attachment is needed, content as plain text
   name of the attachment:  beispiel.csv

- content of the attachment
expample:        
49174;2893611;Martin;Miller;

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.


thanks
hreinart
0
Comment
Question by:hreinart
[X]
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
  • 3
  • 2
  • 2
  • +1
8 Comments
 
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!
0
 

Author Comment

by:hreinart
ID: 9635488
i want the full solution
0
 
LVL 24

Expert Comment

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

http://www-10.lotus.com/ldd/sandbox.nsf/ecc552f1ab6e46e4852568a90055c4cd/f2a06cab68b32b98852568ac00627519?OpenDocument

~Hemanth
0
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!

 

Author Comment

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

Expert Comment

by:HemanthaKumar
ID: 9642556
SMS is simple text msg mail. I don't think that they can handle attachments ? Do they ? I never used SMS !
0
 
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...
0
 

Author Comment

by:hreinart
ID: 9643235
HemanthaKumar:
..so please read my needs in the question.   the attachment is needed, please read above, thanks
0
 
LVL 8

Accepted Solution

by:
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 = "john@sms.com"
      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
                  .Send(False)
            End With
            Set docPerson = dc.GetNextDocument(docPerson)
      Loop
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,
JM
0

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

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

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

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