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

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
hreinartAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sjef BosmanGroupware ConsultantCommented:
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
hreinartAuthor Commented:
i want the full solution
0
HemanthaKumarCommented:
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
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference ithrough the Colors of STEM program.

hreinartAuthor Commented:
did you check if attachments are created, too?  ...in the way i need it?
0
HemanthaKumarCommented:
SMS is simple text msg mail. I don't think that they can handle attachments ? Do they ? I never used SMS !
0
Sjef BosmanGroupware ConsultantCommented:
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
hreinartAuthor Commented:
HemanthaKumar:
..so please read my needs in the question.   the attachment is needed, please read above, thanks
0
Jean Marie GeeraertsApplication EngineerCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.