Just popping in
Joined: 2007/5/15 13:42 Last Login
: 2023/3/8 14:54
From Austria
Group:
Registered Users
|
@Mlehto Here it comes, save it under "GetAddresses.yam" int the Rexx folder of your YAM installation and call it over the script menu. The script will add all new emails from the current folder to your addressbook but will *NOT* save it!
/* GetAddresses.yam - Insert new contacts in adressbook */
/* $VER: GetAddresses.yam 1.0 (18.01.2014) (c) 2014 by Bernd Gollesch <bgollesch@speed.at> */
/* Gets the senders of all messages in the current folder and adds them to the addressbook. */
/* Tested only with YAM 2.9 */
OPTIONS RESULTS
ADDRESS YAM
added = 0
'FolderInfo STEM folder.' /* get the current folder information */
DO i = 0 TO folder.TOTAL-1 /* iterate throu all mails from folder */
DROP mess. /* clear the stem for mailinfo */
'MailInfo 'i' STEM mess.' /* Get mail information */
PARSE VAR mess.FROM name' <'email'>' /* separate name from email */
IF LENGTH(email) = 0 THEN DO /* no email ? */
IF POS('@', name) > 0 THEN DO /* maybe the name has the email */
email = name /* yup, use name as email */
END
END
IF LENGTH(email) = 0 THEN ITERATE /* still no email, -> no entry */
name = STRIP(name, 'B', '"') /* remove quotes from name */
newname = name
cpos = POS(',', name)
IF cpos > 0 THEN DO /* there is a comma in the name, reverse it */
newname = substr(name, cpos+1) substr(name, 1, cpos-1)
END
newname = SPACE(newname, 1) /* strip to one space only */
'AddrFind VAR dummy PATTERN "'email'" EMAILONLY'
IF RC = 5 THEN DO /* email not found, add it */
'AddrNew VAR newalias NAME "'newname'" EMAIL "'email'"'
added = added + 1
END
END
IF added = 1 THEN
'Request BODY "One new addressbook entry" GADGETS "Ok"'
ELSE
'Request BODY "'added' new addressbook entries" GADGETS "Ok"'
EXIT
|