Google people API i cant get the email addresses - google-people-api

gapi.client.people.people.connections.list({
'resourceName': 'people/me',
'pageSize': 120,
'personFields': 'names,phoneNumbers,emailAddresses'
})
[i already specify emailAddresses as one of my personfields but i dont see email address in the response as shown below.this is the response in console.

Maybe check if your scopes allow you access to email addresses and if that contact actually has an email address. I believe the API doesn't even add a field if it's empty, rather than populating a field with an empty value.

The required scope for these fields are:
https://www.googleapis.com/auth/user.phonenumbers.read https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email

Related

AWS SES, sending mail with an unverified 'from'

I'm trying to create a discussion list sender using SES. The 'receive' part is fine, but when I send, I want to preserve the user's "from" address. Aside from some subject rewriting, here's what I'm doing to the headers; VERIFIED_FROM is my mailing list alias. This is py3.6, but it shouldn't matter.
msg['Reply-To'] = VERIFIED_FROM_EMAIL
msg['Return-Path'] = VERIFIED_FROM_EMAIL
When I call sendRawEmail, I get an error like this, brackets for scrubbed entries:
[ERROR] [timestamp] [request id] Client error while forwarding email for <[VERIFIED_FROM_EMAIL]> to <[all emails on list]>: An error occurred (MessageRejected) when calling the SendRawEmail operation: Email address is not verified. The following identities failed the check in region US-WEST-2: ["user who sent the message" user#domain.com]
I can't put all users on the verified list. I could set the 'from' to my list address, but then I lose the identity of the sender.
I'm sure this has been done with SES- but how?
The reply-to field and the return-path field are fields that require a validated email address. [1]
With each email you relay, you can create a unique email address for people to reply to (e.g. abcdef123#yourdomain.com) which you can then relay back to the same threads using the Message-ID and In-Reply-To headers.
You can also modify what the name looks like for the message using the Name <email#yourdomain.com> header too.
[1] https://forums.aws.amazon.com/message.jspa?messageID=221703

WSO2 APIM Store - limited email address validation

deploying an internal (corporate) API manager 2.0.0 we found a limitation - the email address validation apparently enforces email validation with 2-4 email :
/store/site/themes/wso2/templates/ui/validation/custom-validation.js:
$.validator.addMethod('validEmail', function(value, element) {
var emailRegex = /^([A-Za-z0-9_\-\.])+\#([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
return emailRegex.test(value);
}, i18n.t('Invalid email address'));
However - email addresses today may have even long last domain name (e.g. someuser#stad.gent, otheruse#my.internal.corporation)
I see the validation logic is implemented in the followinf file:
repository/deployment/server/jaggeryapps/store/site/themes/wso2/templates/ui/validation/custom-validation.js
Question: is the file the only place where the email format is enforced? (Users are managed in AD, so the default user view / management UI doesn't concern us too much atm)
Seems the only place where the email is validated is the script:
repository/deployment/server/jaggeryapps/store/site/themes/wso2/templates/ui/validation/custom-validation.js

Designing URLs without verbs for operations related to user in a REST API

I'm building REST API.
I have following structure
GET /user/{id} - get
POST /users - Create user
PUT /users/{id} - Update user
DELETE /users/{id} - Delete user
The problem is following. As I got from many tutorials/articles - it is bad practice to use action in URL. But what to do with such actions like:
check email (is unique)
recover user by email
?
Assume user registration. User submits form ( POST /users ) and I need to check if email is unique. Do I need to do it in same api method and return validation errors as response body?
Or do I need to create something like
POST /users/email
And what about user recovering by email? Where do I need to do it? Because recover is verb
POST /users/recover
I'm not sure, that I'm doing it right and I can't find correct explanation for that situation.
Validating the e-mail and registering the user
If you want, you can have an endpoint to check whether an e-mail is already registered or not. It's up to your requirements. So, you can have something as following and then send the e-mail which will be validated in the request payload:
POST /users/email/validation
{
"email": "mail#example.com"
}
The endpoint above can be invoke, for example, when the user completes the e-mail field of your account registration form.
However, do not forget checking if the e-mail is already registered when creating a user:
POST /users
{
"firstName": "John",
"lastName": "Doe",
"email": "mail#example.com",
"password": "123456"
}
If an e-mail is already registered, you could consider returning a 409 Conflict status code and a payload that includes enough information for a user to recognize the source of the conflict.
Recovering the password
I'm unsure if this is your requirement, because of this I posted a comment asking for clarification. I presume you are trying to recover the password of a user, assuming the user has no more access to their account.
If so, you could have an endpoint as following and then send the e-mail of the user in the request payload:
POST /users/password/recovery
{
"email": "mail#example.com"
}
Then your server can send a link with a token to the e-mail specified in the payload. Only send the e-mail if the e-mail specified in the payload is registered in your application, of course.
The link should take the user to a page where they will enter the new password and, when submitting, an endpoint to replace the password of the user will be invoked, sending the token and the new password to the server:
PUT /users/password?token=SomeValueGoesHere
{
"password": "654321"
}

Sitecore ECM op-tin and opt-out roles dates

I want to know is there any way to get user subscrition / unsubscrition to email campaign ?
Is it saved in one of databases/tables in MSSQL ?
If you use the approach with opting in and out being determined on the fact if user is in role, then it is stored in the aspnet_UsersInRoles table in your core database. This table does not keep the information when role was assigned to the user. That's why you cannot get information when user subscribed or unsubscribed to email campaign.
The only thing you can check is if user is in the role:
user.IsInRole(roleName)
The user's subscription is driven by the users role, but It is possible to get the users subscriptions in ECM, You just have to use the api.
You can get the contact from the email address:
string fullName = commonDomain + "\\" + Util.AddressToUserName(username);
var contact = Contact.FromName(fullName);
var subscriptions = contact.GetSubscriptions();
Once you have a contact you can call the GetSubscriptions() method which will return the recipient lists the user is signed up to. There are a host of other methods you can call on a contact and if there is a a way to get the date unsubscribed/subscribed it will be here.
If not reflect Sitecore.EmailCampaign.dll and keep looking! There might be some extra information in the automation states table in the Analytics database. More info on automation state here:
https://www.sitecore.net/learn/blogs/technical-blogs/sitecore-magnified/posts/2013/09/ecm-automation-states-magic.aspx
Also noticed there is a method GetUnsubscribersStatistics on the Sitecore.Modules.EmailCampaign.Core.Analytics.AnalyticsHelper class. This will have the date of unsubscription.

Redirect users to their specified email accounts with receiver and message fields pre-filled

I have an email address "myaddress#gmail.com". I have created a django form that has a text field and a button. I want to redirect anyone who types a message in the text box to their respective emails so that they can send the message they typed to "my address". This means that as they log in to their email accounts, their message boxes should already be filled with the message they typed and the receiver field should already have "myaddress#gmail.com". The problem is how to redirect the users to their email accounts and prefill the specified fields.
Can anyone help me please?
If the user has set a default email program, most of them will be triggered on mailto:. I know gmail works with mailto: as well, and its possible that other web email services might. All desktop email clients - again only if it is set as the default email program will work on mailto:
The format is:
mailto:[emailaddress]?header=value&header1=value1....&headerN=valueN
Here is an example that sets the subject of the email automatically:
Email me