Code to compose mail for a contact

I have a contact directory database. It is desired is to generate an e-mail message for a selected contact using an action button.

I wrote a formula for the action as follows:

REM {Send mail to the current contact};

REM;

SendTo :=@Unique(@Trim(email));

@Command( [MailComposeMemo] )

But this just opens a new memo without the recipients address.

I am new to domino designer and know that this is not as simple as it sounds… somehow I am not able to club together the SendTo with MailCompose here.

Any help would be appreciated.

Thanks!

Subject: Code to compose mail for a contact

Perhaps I was not clear in my earlier post:

This is an address-book type of database for maintaining customer/supplier contacts.

The contact form has a field called ‘email’ to record the mail address.

There is a view that displys contact info using various columns - one of which displays contacts phone, e-mail, etc.

A user in this view should be able to select one (or more) contacts, click on an action button that should open up a blank new memo window that automatically prefills the e-mail addresses of the contacts that were selected from the view.

I tried @MailSend - it opend up a new memo that had the actual contact form in the body of the memo with a blank ‘To’ field.

What I am looking for is something similar to Notes Address Book’s “Write Memo” shared action - that basically allows you to select contact (s) from PAB and launch a new memo that has their e-mail address pre-filled.

Hope I am making some sense here.

Subject: RE: Code to compose mail for a contact

I don’t think you will be able to do this with @fuctions and @commands. You’ll have to do something with LotusScript.

Not very hard, loop through the selected documents to get the e-mail list. Compose a document in the background and then bring it to the front.

This is exactly what is done in the agent: CreateMailMemo in your personal address book. Just take a look at that code and “copy it” and copy the Script Libarary MailLibrary. You probably only need to change GetMailAddress to just pull the address from your email field.

Also GetMailAddress Only pulls the first address, so if your contacts have multiple addressed in them, well you’ll need to tweak the code a bit more.

Subject: RE: Code to compose mail for a contact

Yup … that’s what I am headed for …

Stephen … thanks a lot !

Subject: Code to compose mail for a contact

I believe the problems is you’re assuming the evaluation of SendTo will happen BEFORE the @Command. Unforunately that’s not always the case. Change the @Command @PostedCommand and see if that helps.

Subject: Code to compose mail for a contact

Take a look at @MailSend. It should give you what you want.

Jeff Dayton, PCLP, CLI

Subject: My solution / tested

If you specifically want a New Memo window to open so people can enter something… This will work:

SendTo := @Trim(@Implode(@Name([Abbreviate];@Unique(Author:@UserName));“,”));

@URLOpen(“mailto:” + SendTo+ “?Subject=Optional”)

You can drop the +“?Subject=Optional”) if you do not want the Subject area to be filled in.

@Name - I put in so the when people see the e-mail the is NOT in canonical format (if you store the full name).

@Implode - I put in to handle multiple names, as you do an @unique and I’m guessing you can have more than one name in the field.

If you want to have the system compose the whole message then Jeffrey advice is the way to go.

Hope that helps.

Subject: look in the personal address book

this is a built in feature of Notes. Look in the People view of the Personal Address book. There’s a button at the top of the view called “Write Memo”. Just check the code behind the button. There’s an agent and a script Library you’ll need to copy to your contact directory.