Does Amazon SES support plus addressing? - amazon-ses

I successfully send many emails through Amazon SES... however a handful of them fail due to containing the plus character (plus addressing).
Here's how the emails are sent:
"Key" => "MyKey",
"Secret" => "MySecret",
"Region" => "us-east-1",
"Service" => "email",
"Host" => "email.us-east-1.amazonaws.com",
"Params" => [
"Action" => "SendEmail",
"Destination.ToAddresses.member.1" => "someone+testing#gmail.com",
"Message.Subject.Data" => urlencode("Test Message"),
"Message.Body.Html.Data" => urlencode("<p>Hello, this is a test.</p>"),
"Source" => urlencode("sender#example.com")
The response from Amazon SES is:
InvalidParameterValue
Local address contains control or whitespace
I know I can strip the "+testing" from the address, but don't believe that's the right thing to do. I'm unable to find anything in Amazon's documentation that mentions support for plus addressing or how to escape the plus character.
Has anyone else solved this?

In the AWS addresses with + are possible. The + characters are sth called VERP - Variable Envelope Return Path -> which work exactly as they are supposed to work (https://docs.aws.amazon.com/ses/latest/dg/send-email-concepts-email-format.html)
Are you sure that none of the other part use some strange characters?
You can try changing the encoding to UTF-8: Here is some example for that for SES. https://docs.aws.amazon.com/ses/latest/dg/send-email-raw.html

Related

Puppet provider changes (rabbitmq module)

I'm working on some changes to:
https://github.com/puppetlabs/puppetlabs-rabbitmq/
I haven't worked much with rspec or with puppet types / providers, so it's been slow going. Haven't had much input via their ticket system or in Github, so just wanted to get some advice in terms of the design changes.
Basically, the module doesn't currently support multiple bindings with the same source / destination / vhost combo, but different routing keys.
I had a (mostly) working fix that was backwards compatible involving making routing_key work as either a string or array (https://tickets.puppetlabs.com/browse/MODULES-3679)
However, this doesn't work too well, because the existing provider expects the resource to be unique, and seems to assume a predictable mapping between the title of the resource and the
I had thought about making the title and name attributes different from each other, or even completely abstracting the name / title from the attributes that must be unique:
rabbitmq_binding { 'exchange1#queue1#host3-1':
name => 'exchange1#queue1#host3',
destination_type => 'queue',
routing_key => 'routingkey1',
ensure => present,
}
rabbitmq_binding { 'exchange1#queue1#host3-2':
name => 'exchange1#queue1#host3',
destination_type => 'queue',
routing_key => 'routingkey2',
ensure => present,
}
The actual rabbitmqctl output that self.instances is collecting for each vhost (in an example where there are two routing keys for same source / dest / vhost combo (no vhost in this example) looks like:
foo.bar.exchange exchange axs.bar.baz.queue queue axs.bar.baz.key []
foo.bar.exchange exchange axs.bar.baz.queue queue axs.bar.baz.published.key []
I'd rather not try to encode the routing key in the title / name attribute of the resource, but is it possible to have routing_key also tied to the resource (presumably by updating the exists? method as well as self.instances)? What would be the best things to check in unit tests for this (I already have an acceptance test), and how can I modify lib/puppet/provider/rabbitmq_binding/rabbitmqadmin.rb to support this?
Or do I just need to encode the routing key in the name as well, which just seems really ugly, and would also make backwards compatibility more difficult?
rabbitmq_binding { 'exchange1#queue1#host3#routingkey':
or
rabbitmq_binding { 'exchange1#queue1#/#routingkey':

Outlook webhook notification subscription

I already implemented outlook notification rest api into my code and its work fine but today it suddenly failed and gives me 400 error.
Request outlook for create subscription for notification
Output::
{"error":{"code":"ErrorInvalidParameter","message":"The parameter 'Resource' is invalid."}}
My post data as below ::
URL => outlook.office.com/api/v2.0/me/subscriptions
$subscriptionParameters = json_encode(array(
"#odata.type" => "#Microsoft.OutlookServices.PushSubscription",
"Resource" => "https://outlook.office.com/api/v2.0/me/events",
"NotificationURL" => "https://mydomain/acceptnotification.php",
"ChangeType" => "Created, Updated, Deleted",
"ClientState" => "c75831bd-fad3-4191-9a66-280a48528679"
));
Pass above data to outlook with access_token and email address using cUrl
Please suggest me.
Thank you for reporting this issue. Microsoft engineering team is investigating it right now. Meanwhile, a workaround that worked for multiple subscription cases is to use relative URL for the resource property
e.g.
"Resource": "me/events",
Thanks.

Vb.Net Gmail API Send Message with attachment > 5Mb

On Gmail Api documentation i read that i've to make an HTTP request at "/upload/gmail/v1/users/userId/messages/send" when sending message larger then 5mb but i don't find any example how to implement this using the Client Library in .net
All the examples on the site refer to the "messages.Send" function that takes as parameter a raw message and the user id but i saw that there's another overload that also take the stream of the content to upload and the content type of it.
The problem is that i've no clue how to correctly call it.
Does anyone have successfully achived it ?
Thx for your answer
Simone
Simone, it's means that you use simple upload:
uploadType=media. For quick transfer of smaller files, for example, 5 MB or less.
You must use Multipart upload or Resumable upload (https://developers.google.com/gmail/api/guides/uploads)
You can send a post query with payload (see CURLOPT_POSTFIELDS, if use a CURL) on the https://www.googleapis.com/gmail/v1/users/me/messages/send?access_token=your_access_token&uploadType=multipart. Payload must contain json encoded message. Structure of this message for example:
$message = [
'message' => [
'raw' => str_replace(['+', '/'], ['-', '_'], base64_encode($mimeString)),
'threadId' => $yourThreadId
]
];
Variable $mimeString must contain correct mime string

For every request a new session is getting generated in Yii application

I know I am either skipping something or configured session incorrectly but Yii sessions are not working for me. I have spent a lot of time in debugging and searching but it doesn't result in any concrete answer.
As described in documentation as well as tutorials over internet I have configured my application session as follows:
'components'=>array(
'user'=>array(
// enable cookie-based authentication
'allowAutoLogin'=>true,
),
'session' => array (
'sessionName' => 'Site Session',
'class'=>'CHttpSession',
'useTransparentSessionID' =>($_POST['PHPSESSID']) ? true : false,
'autoStart' => 'true',
'cookieMode' => 'allow',
'timeout' => 300
),
However each time I am sending a request to server, I get a new session object. I have verified same via echo "Session id: ".Yii::app()->session->sessionID;, every time it gives me different id. Also variables which I have added in session previously are not accessible due to this behaviour.
Kindly provide some pointers, I have spent more than 4 hours in debugging and looking for a solution. Tons of thanks for any pointers in advance.
Thanks
~Tarun
It could well be just that you have a space in your sessions name.
I've just done a quick test on my working Yii instance, changed the session name to have a space in it, and the cookie value for the session seems to change every time.
Please read php session name documentation at this url http://php.net/manual/en/function.session-name.php
It clearly mentions that session name should contain only alphanumerical characters. That too it should contain at least one alphabet(session name cannot have all its characters as digits also). Otherwise a new session id is generated every time.
chrome 44 and chrome 47's bug , update it to 51,It's ok.
Just a note cause I ran into this issue in Yii2. I had a constant COOKIE_DOMAIN that was set via php-fpm config and it was for the wrong domain name, causing the session to reset. Make sure this is set to ".example.com" (including the . at the start to support all your hostnames)
'components'=>[
'session' => [
'class' => 'yii\web\DbSession',
'cookieParams' => [
'path' => '/',
'domain' => COOKIE_DOMAIN, // <<<--- check this
'secure' => true,
],
'writeCallback' => function($session){
return [
'user_id' => Yii::$app->user->id
];
},
'sessionTable' => 'session', // session table name. Defaults to 'session'.
],
...
]

How do I sign a google federated login?

Ok Im having more luck with G'oogle's federated log in, I'm at the point where you get the following params back from Google.
[openid_ns] => http://specs.openid.net/auth/2.0
[openid_mode] => id_res
[openid_op_endpoint] => https://www.google.com/accounts/o8/ud
[openid_response_nonce] => 2010-01-02T14:58:22ZvP-t8tJXqGWaPw
[openid_return_to] => http://localhost/blablabla/index.php?c=google
[openid_assoc_handle] => AOQobUdTUUFVqQ9PeC9r19-rHOlEg_xvFmiIUahkmhNQ7Blrh14w2-eb
[openid_signed] => op_endpoint,claimed_id,identity,return_to,response_nonce,assoc_handle,ns.ext1,ext1.mode,ext1.type.firstname,ext1.value.firstname,ext1.type.email,ext1.value.email,ext1.type.lastname,ext1.value.lastname
[openid_sig] => tUZtUtVcvOfrodpPEx4bItcxVME=
[openid_identity] => https://www.google.com/accounts/o8/id?id=xxxxxxxxxxxxxxxxxx
[openid_claimed_id] => https://www.google.com/accounts/o8/id?id=xxxxxxxxxxxxxxxxxx
[openid_ns_ext1] => http://openid.net/srv/ax/1.0
[openid_ext1_mode] => fetch_response
[openid_ext1_type_firstname] => http://axschema.org/namePerson/first
[openid_ext1_value_firstname] => myName
[openid_ext1_type_email] => http://axschema.org/contact/email
[openid_ext1_value_email] => user#gmail.com
[openid_ext1_type_lastname] => http://axschema.org/namePerson/last
[openid_ext1_value_lastname] => MySurname
The only thing I need to do now is sign it and' If I understand this correctly google is giving me a clue with [openid_signed]
ie: string those params together and then creating the hash out of the concatenated strin the should equal [openid_sig] => tUZtUtVcvOfrodpPEx4bItcxVME=
But Im sure there is more to the signature generating formula - anyone know what it is since I cant find it in Google's documentation anywhere?
You can use JanRain's RPX-Now for the same. It has a much simpler and allows almost all OpenID providers. https://rpxnow.com/
Google Federated Login is, with a few minor changes, OpenID. Rather than looking for docs on Google Federated Login's signature protocol, look for information on what how to generate a signature and how to verify the signature.
Even if you don't want to use the JanRain code, you could still get some answers to these questions by looking at the code. For instance, the verify function on line 1320 of /Auth/OpenID/Server.php seems to be where the code for verifying the signature starts.