Implementing List-Unsubscribe header(s) with swiftmailer (rfc2369, rfc6068, rfc8058, and friends) - header

Has anyone implemented the List-Unsubscribe & List-Unsubscribe-Post headers using swiftmailer ?
I know how to insert headers ...
$_headers = $message->getHeaders();
$_headers->addTextHeader( 'List-Unsubscribe', $list_unsubscribe );
if ( $has_dkim ) $_headers->addTextHeader( 'List-Unsubscribe-Post', 'List-Unsubscribe=One-Click' );
$list_unsubscribe variable may contain one <url> and/or one <mailto>
1st problem : Whatever the order of List-Unsubscribe and List-Unsubscribe-Post headers are set, they always appear in the wrong order (List-Unsubscribe-Post before List-Unsubscribe).
I tried to change header ordering using method defineOrdering, but that did not work as intended.
I even tried to hack the swiftmailer code to append those two new headers to the existing order list ... but did not work !
2nd problem : Would appreciate any hint on how to encode properly these two <url> & <mailto> using swiftmailer toolbox (i am also using the Decorator plugin).
Thank you for your answers.

So, 1st problem is solved !
According to RFC 5322
... header fields are not guaranteed to be in a particular order.

Related

Update existing header field in asterisk

I am new to and working on asterisk. I have a question.
How to extend a string to an existing header field in asterisk?
For example, after calling:
add_header(req, "User_Note", "swim fast");
User_Note has value "swim fast". I want to add "run quickly" to the value of "User_Note". So "User_Note" will be "swim fast, run quickly".
If you're referring to Asterisk dialplan code, you can't remove a SIP header that comes in with the call. You can add another instance of the same header using SIPAddHeader(), and change the code on the far end to interpret multiple values correctly.
The example you have up there is not Asterisk dialplan though.

How to store extra header value with MailCore2?

I add an extra header value with MailCore2:
MCOMessageHeader *messageHeader = message.header;
[messageHeader setExtraHeaderValue:spamScoreString forName:#"Spam Score"];
How can I save this new header value to the IMAP server?
I have already searched for sample code and I have also read the class reference for MCOMessageHeader (which, by the way, states the wrong method name - (void)addHeaderValue:(NSString *)value forName:(NSString *)name)
editWith the help of dinhviethoa in the MailCore2 forum on GitHub (https://github.com/MailCore/mailcore2/issues/680), the question could be answered:
It is not possible to edit the header of an existing email.
However, it is possible to remove the existing message from the server and append a new message (with extra headers).

Using rally-api (ruby) how do you get the State value of a porftfolio item ?

Using the rally-api I have been trying to access the portfolio kanban state value of items eg.
features.each do |feature|
puts feature.State # also tried feature.State.Name
...
end
But this always return an empty string.
this looks to be a back end WSAPI change that is coming. PI states are going to become readable via the wsapi in 1.37, but they are not currently returned when you query for Portfolio Items. When wsapi 1.37 comes out, if you pass :version => 1.37 to the config to rally_api, you should then be able to get it in the fetch string.
It is easily accessed by using "feature.State.Name". However, in the Ruby toolkit, these fields are all lowercase, with Pascal-cased field names using underscores(_) to represent the casing. It should be, in this case:
put feature.state.name
and in a more complex case (PlannedRemovalDate):
put feature.planned_removal_date
Hope this helps.

How to add a HTTP header field in Openacs?

I need to add a HTTP header field in the responses of a section of my site, the package instace (my section) is being viewed in a IFRAME and I want to declare a p3p field in order to be able to store cockies in IE 6/7/8 (login doesn't work well), I have an idea of how to do it in PHP and is quite simple:
<?php
header('P3P: CP="CAO PSA OUR"');
?>
but I didn't found how to do it in TCL/openacs, thanks for the help.
Based on Jim Lynch's response when you asked this question elsewhere, you just need to add it to the set of headers being produced for the page.
I'd guess that something like this is probably easiest (assuming you don't want to hard-code the contents of the header; if you did, you could simplify a little):
set cpflags "CAO PSA OUR"
ns_set cput [ns_conn outputheaders] "P3P" "CP=\"$cpflags\""
To understand it, you need to read about ns_conn and ns_set from the AOLserver docs, as well as set from the standard Tcl documentation.

Preventing YQL from URL encoding a key

I am wondering if it is possible to prevent YQL from URL encoding a key for a datatable?
Example:
The current guardian API works with IDs like this:
item_id = "environment/2010/oct/29/biodiversity-talks-ministers-nagoya-strategy"
The problem with these IDs is that they contain slashes (/) and these characters should not be URL encoded in the API call but instead stay as they are.
So If I now have this query
SELECT * FROM guardian.content.item WHERE item_id='environment/2010/oct/29/biodiversity-talks-ministers-nagoya-strategy'
while using the following url defintion in my datatable
<url>http://content.guardianapis.com/{item_id}</url>
then this results in this API call
http://content.guardianapis.com/environment%2F2010%2Foct%2F29%2Fbiodiversity-talks-ministers-nagoya-strategy?format=xml&order-by=newest&show-fields=all
Instead the guardian API expects the call to look like this:
http://content.guardianapis.com/environment/2010/oct/29/biodiversity-talks-ministers-nagoya-strategy?format=xml&order-by=newest&show-fields=all
So the problem is really just that the / characters gets encoded as %2F which I don't want to happen in this case.
Any ideas on how this can be achieved?
You can also check the full datatable I am using:
http://github.com/spier/yql-tables/blob/master/guardian/guardian.content.item.xml
The URI-template expansions in YQL (e.g. {item_id}) only follow the version 3 spec. With version 4 it would be possible to simply (only slightly) change the expansion to do what you want, but alas not currently with YQL.
So, a solution. You could bring a very, very basic <execute> block into play: one which adds the item_id value to the path as needed.
<execute><![CDATA[
response.object = request.path(item_id).get().response;
]]></execute>
Finally, see the diff against your table (with a few other, minor tweaks to allow the above to work).