Solved

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

Posted on 2003-10-28
8
200 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
  • 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
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

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

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