First Last Prev Next    No search results available
Details
: Populate Mail Headers: To, Cc, Bcc, Subject and Others
Bug#: 25904
: smarttemplate4
: General
Status: RESOLVED
Resolution: FIXED
: PC
: Linux
: unspecified
: P3
: enhancement
: ---

:
:
:
:
:
  Show dependency tree - Show dependency graph
People
Reporter: Fred Seltzer <fredistic@gmail.com>
Assigned To: Axel Grude <axel.grude@gmail.com>
:

Attachments
Explains use of %addressee (88.94 KB, image/png)
2014-11-27 06:27, Fred Seltzer
no flags Details
Version 1.1 pre 18 (353.30 KB, application/x-xpinstall)
2015-07-27 14:22, Axel Grude
no flags Details
Version 1.1 pre 19 (353.47 KB, application/x-xpinstall)
2015-07-28 01:14, Axel Grude
no flags Details
Version 1.1 pre 22 (353.73 KB, application/x-xpinstall)
2015-07-28 04:46, Axel Grude
no flags Details


Note

You need to log in before you can comment on or make changes to this bug.

Related actions


Description:   Opened: 2014-11-27 06:27
Created an attachment (id=7965) [details]
Explains use of %addressee

For sending email to a list of email addresses and/or Mailing Lists from, for
example, the Personal Address Book or the Collected Addresses.

Proposed new fields would be something like this:
        %addressee(to, <email address>)%
        %addressee(cc, <email address>)% 
        %addressee(bcc, <email address>)% 

        %addressee(bcc, SmithFamily)% 
        %addressee(bcc, WorkBuddies)% 
        %addressee(to,  WarmFusionProjectMembers)% 

Choosing the appropriate stationery would set the content and format of the
e-letter and also fill in the destination.  This implies using both stationery
and st4.

It would also be useful to fill in the subject field as follows:

        %subject("Warm Fusioneers: %cursor%")%
After that, typing a tab character would jump the cursor to the %cursor% in the
body of the e-letter.
------- Comment #1 From Axel Grude 2014-11-27 07:40:59 -------
Renaming the bug. Please do not combine 2 feature requests in the same bug, if
you want a way to auto-fill the subject field from the template, please raise a
separate bug, as this is a completely different task for development. The
various address fields are reasonably similar and can use the same programming
logic.

My suggestion is that the first version will take single _email addresses_ as
arguments, like so:


        %addressee(bcc, fred@smith.com)% 
        %addressee(bcc, george@smith.com)% 
        %addressee(bcc, martha@smith.com)% 

so *one email address* per line. Supporting groups or lists is a lot more
difficult. But you can add as many lines as you like into one template. Later
on I might be able to discuss supporting lists / groups (or maybe even reading
a list from file?) but that's strictly "version 2" for this feature.

> Choosing the appropriate stationery would set the content and format of the
e-letter and also fill in the destination.  This implies using both stationery
and st4.

There is no reason to not support this from the template fields as well. If you
have an email identity that you share with a group, cc'ing or bcc'ing a person
or number of people would still make sense. Also, you can have multiple
identities on the same mail account.

I personally prefer Stationery as it is easy to select the template from the
Reply button.
------- Comment #2 From Axel Grude 2014-11-27 07:46:55 -------
(In reply to comment #1)
> 
> so *one email address* per line. Supporting groups or lists is a lot more
> difficult. But you can add as many lines as you like into one template. Later
> on I might be able to discuss supporting lists / groups (or maybe even reading
> a list from file?) but that's strictly "version 2" for this feature.
> 
> > Choosing the appropriate stationery would set the content and format of the
> e-letter and also fill in the destination.  This implies using both stationery
> and st4.
> 

Additional requirements:

1 - when Replying, the original To / Cc list will be *reused* and merged with
the email addresses from the new feature

2 - the original mail addresses (and their use in the respective fields
to/cc/bcc) have preference over the ones added by the template


this means that if you "reply all" to an email that was sent to "fred" then
adding the same "fred" (based on email address) with cc or bcc using the
feature will be ignored (as he already is in the to field). Likewise, if "fred"
is on the cc or bcc list of the original mail, adding

   %addressee(to, fred@smith.com)%

will be ignored. In corporate email it is usually important to keep Cc and To
in the original hierarchy, so the feature must honor and not override this.
------- Comment #3 From Axel Grude 2015-07-09 03:59:26 -------
Let's make this one a little more universal. Let us say we want to be able to
modify multiple mail headers by adding (in the case of to / cc / bcc) or
changing the information (subject line, tags?, list-id etc.)

so I would propose a more universal variable called

%header% 

which could be used according to these examples

%header(to, <email address>)%
%header(from, <email address>)%
%header(cc, <email address>)%
%header(bcc, <email address>)%

%header(subject, "New Subject line")%
%header(Newsgroups, "mozilla.support.thunderbird")%
%header(List-Id, "Thunderbird help community
<support-thunderbird.lists.mozilla.org>")%

Extended Behavior
-----------------

an optional extension parameter (for AB groups) could be placed at the end:
%header(to, <group name>, group)%

Subject line should probably allow quoting the original subject when replying
%header(subject, "New Subject", prefix)%  - could pre-pend the new subject to
the original subject line
%header(subject, "New Subject", postfix)%  - could append the new subject to
the original subject line

All header variables will have to be parsed before any other processing in
composer, appropriate mail headers modified / inserted and then obviously
removed from the body of the email.
------- Comment #4 From Axel Grude 2015-07-09 04:11:14 -------
*** Bug 25981 has been marked as a duplicate of this bug. ***
------- Comment #5 From Axel Grude 2015-07-09 04:14:34 -------
Another special use case would be

%header(subject, "")% 

in order to force an empty subject line which has been requested in [bug 2581]
(a 'nice to have' would be also disabling the message that warns you about an
empty subject line)
------- Comment #6 From Axel Grude 2015-07-09 04:51:57 -------
*** Bug 25152 has been marked as a duplicate of this bug. ***
------- Comment #7 From Axel Grude 2015-07-09 04:58:23 -------
According to the merged [Bug 25152] we might need a way of including other
headers in the subject line. This will yet again require a special syntax - we
saw the problem of nesting variables as arguments of other variables before.

The problem is that the recursive pattern

%foo(%bar()%)%

is fairly difficult to parse with a Regular Expression, which is what ST4
currently does in order to resolve variables. I will have to think about this
and might have to come up with a different syntax for included headers, such as

%header(subject, "some text - {from(mail)}")%

this would have to detect (and resolve) the bracketed expression(s) within the
%...% block first

{from(mail)}  ==> email@domain.com

and then continue with 
%header(subject, "some text - email@domain.com")% as normal. A general
mechanism like this that would work in all parameter fields of the format

%var(parameters)%

would be desirable. Please comment.
------- Comment #8 From MarkyMarkDE 2015-07-09 05:47:22 -------
(In reply to comment #7)
> According to the merged [Bug 25152] we might need a way of including other
> headers in the subject line. This will yet again require a special syntax - we
> saw the problem of nesting variables as arguments of other variables before.
> 
> The problem is that the recursive pattern
> 
> %foo(%bar()%)%
> 
> is fairly difficult to parse with a Regular Expression, which is what ST4
> currently does in order to resolve variables. I will have to think about this
> and might have to come up with a different syntax for included headers, such as
> 
> %header(subject, "some text - {from(mail)}")%
> 
> this would have to detect (and resolve) the bracketed expression(s) within the
> %...% block first
> 
> {from(mail)}  ==> email@domain.com
> 
> and then continue with 
> %header(subject, "some text - email@domain.com")% as normal. A general
> mechanism like this that would work in all parameter fields of the format
> 
> %var(parameters)%
> 
> would be desirable. Please comment.
> 

Axel we have such a option, take a look in our help ;-)
Here it is Called %...% = Any Header Field and this means if your header have
the Field eg "Reply-To:" you can use %Reply-To% and this results its Value.
Note: not all senders set the same headers so it can happen that mail1 has such
a field and mail2 don't have this field!
------- Comment #9 From MarkyMarkDE 2015-07-09 05:55:37 -------
(In reply to comment #8)
> (In reply to comment #7)
> > According to the merged [Bug 25152] we might need a way of including other
> > headers in the subject line. This will yet again require a special syntax - we
> > saw the problem of nesting variables as arguments of other variables before.
> > 
> > The problem is that the recursive pattern
> > 
> > %foo(%bar()%)%
> > 
> > is fairly difficult to parse with a Regular Expression, which is what ST4
> > currently does in order to resolve variables. I will have to think about this
> > and might have to come up with a different syntax for included headers, such as
> > 
> > %header(subject, "some text - {from(mail)}")%
> > 
> > this would have to detect (and resolve) the bracketed expression(s) within the
> > %...% block first
> > 
> > {from(mail)}  ==> email@domain.com
> > 
> > and then continue with 
> > %header(subject, "some text - email@domain.com")% as normal. A general
> > mechanism like this that would work in all parameter fields of the format
> > 
> > %var(parameters)%
> > 
> > would be desirable. Please comment.
> > 
> 
> Axel we have such a option, take a look in our help ;-)
> Here it is Called %...% = Any Header Field and this means if your header have
> the Field eg "Reply-To:" you can use %Reply-To% and this results its Value.
> Note: not all senders set the same headers so it can happen that mail1 has such
> a field and mail2 don't have this field!
> 
IGNORE THIS COMMENT PLEASE, I HAVE MISUNDERSTAND!
------- Comment #10 From Axel Grude 2015-07-09 05:57:29 -------
(In reply to comment #8)
> (In reply to comment #7)
> > According to the merged [Bug 25152] we might need a way of including other
> > headers in the subject line. This will yet again require a special syntax - we
> > saw the problem of nesting variables as arguments of other variables before.
> > 
> > The problem is that the recursive pattern
> > 
> > %foo(%bar()%)%
> > 
> > is fairly difficult to parse with a Regular Expression, which is what ST4
> > currently does in order to resolve variables. I will have to think about this
> > and might have to come up with a different syntax for included headers, such as
> > 
> > %header(subject, "some text - {from(mail)}")%
> > 
> > this would have to detect (and resolve) the bracketed expression(s) within the
> > %...% block first
> > 
> > {from(mail)}  ==> email@domain.com
> > 
> > and then continue with 
> > %header(subject, "some text - email@domain.com")% as normal. A general
> > mechanism like this that would work in all parameter fields of the format
> > 
> > %var(parameters)%
> > 
> > would be desirable. Please comment.
> > 
> 
> Axel we have such a option, take a look in our help ;-)
> Here it is Called %...% = Any Header Field and this means if your header have
> the Field eg "Reply-To:" you can use %Reply-To% and this results its Value.
> Note: not all senders set the same headers so it can happen that mail1 has such
> a field and mail2 don't have this field!
> 
You misunderstood the purpose of this bug:

%var% reads the header and inserts it into the body of the email
%header(var)% is supposed to *write* to the header of the email (not the body)
It should also be allowed to create any non-standard header. E.g.

%header(x-hobbyGroup, "Stamp Collectors")%

This would create a new mail header "x-hobbygroup" and set its value to "Stamp
Collectors". It would not show up in the email body itself.
------- Comment #11 From Axel Grude 2015-07-27 11:59:08 -------
Let's extend this a little, for the purpose of _modifying_ rather than just
setting the field, in order to accommodate the requirements of [Bug 26057]. So
instead of only setting a field we should also allow changing via prefixing or
appending.

%header.set(subject,"string")%
%header.prefix(subject,"string")%
%header.append(subject,"string")%

prefix and append could be "intelligent" by avoiding prefixing the string
multiple time (if it starts with "string" I wont prefix "string" again)

I have marked [Bug 26057] as duplicate of this one.

Note: the first argument of the header function (the affected field) will be
vetted by me and Mark in order to avoid any abuses. So initially we will only
allow modifying a handful of headers.

address fields:

%header.set(to, "a@b.com")%  - will replace the current to address
%header.append(to, "a@b.com")% - will add another address
------- Comment #12 From Axel Grude 2015-07-27 11:59:52 -------
*** Bug 26057 has been marked as a duplicate of this bug. ***
------- Comment #13 From jkadash 2015-07-27 12:19:56 -------
My request was marked as a duplicate of this.  This combines a lot of issues,
and the discussion appears to address more difficult issues than I need to
accomplish. 

I want the subject field in the header (not the body) to be modified.
I want to be able to preserve the old subject line and insert a fixed string of
text in from of the old header.

Example:
Original message has a subject:
Help me with Java problem

What I want the reply to look like is, (inserting a fixed string"[Support
reply"])
[Support reply] Help me with Java problem

Please include an example of how to do it, if it is already possible.
------- Comment #14 From Axel Grude 2015-07-27 12:41:36 -------
(In reply to comment #13)
> My request was marked as a duplicate of this.  This combines a lot of issues,
> and the discussion appears to address more difficult issues than I need to
> accomplish. 
> 
> I want the subject field in the header (not the body) to be modified.
> I want to be able to preserve the old subject line and insert a fixed string of
> text in from of the old header.
> 
I understand this.  It is not currently possible to _modify_ _any_ headers with
ST4. You can only write to the _body_ of the email. Changing the Email headers
is an entirely different class of problems and deviates from anything that
SmartTemplate4 has done so far. Setting the subject is just as difficult / easy
as setting to, from or cc; it is not a simple string replacement in the body of
the email. 

So this is the correct bug to handle this problem. Subject might well end up
being the first header that this feature supports but there is no need to do
all the work and restrict it to just the one special case when we can use it of
adding bcc or cc addresses or possibly other useful things.
------- Comment #15 From Axel Grude 2015-07-27 14:22:18 -------
Created an attachment (id=8077) [details]
Version 1.1 pre 18

Here is a test version. Successful tests I did so far:


%header.prefix(subject,"test: ")%

- added the string "test: " at the start of the subject line

%header.append(to,"realraven@hotmail.com")%

- added the email address realraven@hotmail.com as a recipient. 

both examples will avoid "duplications".

List of supported headers (so far):
 subject
 to
 from
 cc
 bcc
 reply-to
------- Comment #16 From jkadash 2015-07-27 15:34:50 -------
Fantastic!  I downloaded 1.1 pre 18 and it works exactly as I need. Thank you
so much!  
------- Comment #17 From Axel Grude 2015-07-28 01:01:25 -------
(In reply to comment #16)
> Fantastic!  I downloaded 1.1 pre 18 and it works exactly as I need. Thank you
> so much!  
> 

Not too fast :) wait until you have tested it in a conversation with some back
and forth; you might still find unnecessary duplication of the prefixed term.
Consider this example. Let's say your term is [key] which you want prefixed.
You would have the following behavior in a conversation, starting from the
original subject.

Inquiry about your Software
[key] Re: Inquiry about your Software
Re: [key] Re: Inquiry about your Software
[key] Re: Re: [key] Re: Inquiry about your Software
Re: [key] Re: Re: [key] Re: Inquiry about your Software
[key] Re: Re: [key] Re: Re: [key] Re: Inquiry about your Software

etc.
an improved behavior for prefix would be to only mention the term _once_ like
this:
Inquiry about your Software
[key] Re: Inquiry about your Software
Re: [key] Re: Inquiry about your Software
Re: Re: [key] Re: Inquiry about your Software
Re: Re: Re: [key] Re: Inquiry about your Software
Re: Re: Re: Re: [key] Re: Inquiry about your Software

This would be the more "natural" behavior and would prevent your subject
growing into a "monster" with the same keyword over and over. I am currently
testing an improved version for prefixing the subject only _once_...
------- Comment #18 From Axel Grude 2015-07-28 01:14:59 -------
Created an attachment (id=8078) [details]
Version 1.1 pre 19

Improved version which avoids term duplication in subject.

For prefixing subject, this pretty much behaves as described in comment #18

I have already edited all my Addon Templates to force prefixing [addonName] to
my correspondence to test drive this for a while.

Example (note the space after [SmartTemplate4] ):

%header.prefix(subject,"[SmartTemplate4] ")%
------- Comment #19 From Axel Grude 2015-07-28 04:46:26 -------
Created an attachment (id=8079) [details]
Version 1.1 pre 22

1) (header.append) Fixed duplications on %headers.append% command for subject.
2) (header.append) Omits adding Cc addresses that are already in To
3) (header.append) Omits adding To addresses that are already in Cc

This version also manages to avoid duplications when appending a term.

usage:
%header.append(subject,"term")%

to and cc will suppress adding email addresses to "the other" field. The
question is, should bcc also suppress "accidental" cc's? Probably no - my
reasoning is if a recipient is already on the official to/cc list adding him
(automatically) to bcc should not change that.

usage:
%header.append(to,"name@domain.com")%
%header.append(cc,"name@domain.com")%

First Last Prev Next    No search results available