Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: set variables from addressbook fields #25

Closed
macdeport opened this issue Dec 9, 2019 · 10 comments
Closed

Feature request: set variables from addressbook fields #25

macdeport opened this issue Dec 9, 2019 · 10 comments

Comments

@macdeport
Copy link

@macdeport macdeport commented Dec 9, 2019

SmartTemplate4 already reads and use the addressbook fields %firstname% & %name% from a given email address.

It could be nice other addressbook fields can be read in the same way.

@macdeport macdeport closed this Dec 9, 2019
@macdeport macdeport reopened this Dec 9, 2019
@macdeport macdeport closed this Dec 9, 2019
@RealRaven2000 RealRaven2000 reopened this Dec 9, 2019
@RealRaven2000

This comment has been minimized.

Copy link
Owner

@RealRaven2000 RealRaven2000 commented Dec 9, 2019

Not sure why you closed this item (twice)? I am reopening it from here to start the discussion.

Ok, so let's start by adding some new field switches for the %from%, %to% %cc% and %bcc% variables; from the Edit Contact pages we could potentially extract:

Contact

nickname
additionalmail
chatname

Private

city
address1
address2
state
country
zipcode

at the moment these items are just concatenated with space, like this:

%to(firstname,lastname,chatname,city,state,country)%

This would result in something like this:

John Smith @JoeSmith123 Toronto Canada

leaving out the missing parts. It might be helpful to be able to add a delimiter (ideally html) so be able to make a vertical list (maybe even a table). Maybe, by adding this as (optional) literal last parameter it may be more useful, something like this:

%to(address1,address2,city,state,country,zipcode,"<br>")%

the "
" would then be pre-pended to any non-empty value instead of a space character. empty values would just be ignored.

Questions

  • should the "resolve names from address book" be a mandatory setting for this to work?
  • if no entry is found in AB then firstname, lastname, name are extracted from the email address. is there any potential problems with this approach if you want to do advanced stuff from address book?
@macdeport

This comment has been minimized.

Copy link
Author

@macdeport macdeport commented Dec 9, 2019

"Not sure why you closed this item (twice)?" just a neophyte's false move ;-)

@macdeport

This comment has been minimized.

Copy link
Author

@macdeport macdeport commented Dec 9, 2019

Philosophy:

If the user spends time feeding the AB, it is likely to contain relevant information that can be used to enrich a response specific to the recipient(s).

A minimum (or a little more) of ST4 "conditional" such as [[...]] should allow you to take advantage of the information in the address book or, on the contrary, to manage its absence.

@RealRaven2000

This comment has been minimized.

Copy link
Owner

@RealRaven2000 RealRaven2000 commented Dec 9, 2019

A minimum (or a little more) of ST4 "conditional" such as [[...]] should allow you to take advantage of the information in the address book or, on the contrary, to manage its absence.
Yes, but that one is working through a really bad hack, so I don't like using that syntax. Normally the text replacement/insertion functions are programmed to not insert anything if they do not find any information.

At the moment AB lookup is only employed when the option "resolve names from address book" is activated. It means it will override whatever the user has give in his address line and use what you have in your AB for the name / firstname / lastname parameters.

@macdeport

This comment has been minimized.

Copy link
Author

@macdeport macdeport commented Dec 9, 2019

Thanks pointing out a more generic already existing mechanism for conditional replacement/insertion.

So variables of names such %ABfield_name% (if implemented), combined with text replacement/insertion functions, would make a great job.

@RealRaven2000

This comment has been minimized.

Copy link
Owner

@RealRaven2000 RealRaven2000 commented Dec 9, 2019

Thanks pointing out a more generic already existing mechanism for conditional replacement/insertion.

So variables of names such %ABfield_name% (if implemented), combined with text replacement/insertion functions, would make a great job.

not quite. The Adressbook item is derived using the email address using one of the standard headers:

%to(options)%
%from(options)%
%cc(options)%
%bcc(options)%
%reply-to(options)%

it's documented here: http://smarttemplate4.mozdev.org/variables.html#to and can also be looked up in the variables tab on the variables tab on the "advanced" section of the SmartTemplate⁴ Settings window:
image

One thing I am missing there, however, is the in-depth description of the ?? operator which is relatively new.

a function %ABfield_name% would be without meaning because SmartTemplate⁴ wouldn't know which AB card to choose.

I should probably also add a chapter about the bracketMail( ) sub-function and how its arguments work. The syntax is somewhat clunky because I am using regular expressions for parsing, which makes it very hard to "nest" functions. (You cant write something like %function(%function2(arg2)%,arg)% )

By the way, if you have multiple arguments, don't be tempted to add space after the commas, my parser doesn't like that!

@macdeport

This comment has been minimized.

Copy link
Author

@macdeport macdeport commented Dec 9, 2019

I am specially interested by Other fields:
Custom 1...Custom 4 (for special actions if implemented)
and the generic Notes

floating-screenshot-204556

For example, the next time you reply to this recipient you can display automatically the remainder stored in his Notes

@RealRaven2000

This comment has been minimized.

Copy link
Owner

@RealRaven2000 RealRaven2000 commented Dec 9, 2019

I am specially interested by Other fields:
Custom 1...Custom 4 (for special actions if implemented)
and the generic Notes
For example, the next time you reply to this recipient you can display automatically the remainder stored in his Notes

sure let's expand; I see there is also an address field in work, so let me expand the variables, like this:

Contact (no prefixes here)

firstname
lastname
name (I believe, this should be taken from Display if it exists)
nickname
additionalmail
chatname
workphone
homephone
fax
pager
mobile

Private

private.city
private.address1
private.address2
private.state
private.country
private.zipcode
private.webpage

Other

other.custom1
other.custom2
other.custom3
other.custom4
other.notes

Work

work.title
work.department
work.organization
work.address1
work.address2
work.city
work.state
work.country
work.zipcode
work.webpage

@RealRaven2000

This comment has been minimized.

Copy link
Owner

@RealRaven2000 RealRaven2000 commented Dec 13, 2019

Still work in progress - I am leaving for Germany for the next 10 days; going to bring the laptop, maybe going to release a trial version here when I get some programming time in between. It appears that some AB fields are still not working, most likely just naming issues...

@RealRaven2000

This comment has been minimized.

Copy link
Owner

@RealRaven2000 RealRaven2000 commented Jan 9, 2020

Implemented in v 27 - released on 09/01/2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.