I want to get the string that the user entered as his sender name when sending emails. I can get this from the message API, however it changes sometimes when e.g. the user sends an email through a service like Google Slides. I need the value the user entered manually when he set up his account. What is the best way to get this value?
You need to use another API endpoint. You need to send GET request to this url: https://www.googleapis.com/gmail/v1/users/MAIN_EMAIL_OF_USER/settings/sendAs/EMAIL_THAT_WILL_BE_USED_FOR_SENDING
If you use python library provided by google you can use this endpoint:
service.users().settings().sendAs().get(userId='MAIN_EMAIL_OF_USER', sendAsEmail='EMAIL_THAT_WILL_BE_USED_FOR_SENDING')
More about sendAs user settings in Gmail API you can find here:
https://developers.google.com/gmail/api/v1/reference/users/settings/sendAs
Related
I am using python to send a scorecard to users on a monthly basis. I would like to use the delegated Gmail account to send email to users. Attached images for your reference.
I can send email to users using my personal account. But I can't send email to users using the Delegated account.
Attached error message screenshot here. I google error message and I couldn't find any posts related to the error message.
Gmail Delegated Account Image
Python Script Image
Python Error Message Image
You probably need to let less secure apps access your account.
See the related Google answer: https://support.google.com/accounts/answer/6010255?hl=en
Btw, that's written in the "support.google.com" link.
There is one problem. I need users` emails to register a new one in my application. In other words, email is required for users. But there are Facebook accounts that do not have an email attached. So, in a result, we get an error.
I see one solution: when we recognized that Facebook returned us data without Facebook, show a form where a user should enter his email, he wants to use in the application. And then we can continue register process. But how to realize this? Actually, I have no idea.
What about you?
Thanks
Python social auth partial pipelines is the feature for that, their purpose is to interact with the user to fetch extra data needed for the authentication, for instance requiring emails, confirming the email address, etc.
Check the example application at https://github.com/python-social-auth/social-examples/blob/master/example-django/example/settings.py#L216, it implements a partial pipeline that requests user email if it's missing from the authentication data.
I have a small Django project that supports logging in via Facebook. I'm not using any pluings (like social-auth et al). I'm using FB's Javascript sdk to do the authentication.
I'm sending the access token back to my view, however, I need the FB user id. How do I query FB for the User ID from the access token?
I was sending the FB user id at first, however, any one can tamper with the it and I had no way to know if the ID is actually authentic.
Thank you.
The user id should be available together with the access token, although, in order to verify it, you need to either extract it from a signed request, or retrieve it using an api call to https://graph.facebook.com/me using the token.
I'm using python 2.7 on GAE. When a user makes a request via a browser, I can get 'meta details' such as IP, browser type, request time and the user object, if they are logged in.
I have set up GAE to receive emails. What equivalent kind of 'meta details' can I retrieve from an inbound email and how do I get that information?
The InboundEmailMessage class has the most frequently used fields ready for direct access. These are:
subject
sender
to
cc
date
attachments
original
It also include original field that exposes the full meessage as a Python email.message.Message - this allows you access to all the email headers and potentially lots more.
I'm using django-socialregistration and facebook python sdk.
This is the code to get friends:
friends = request.facebook.graph.get_connections('me', 'friends')
I can get their name and id but I can't get their email address (not their #facebook.com email).
This is another attempt which also can't get their email.
for friend in friends['data']:
request.facebook.graph.get_object(friend['id'])
How can I get the facebook friends email?
It is possible to get the email of a user connected to your app using Graph. However, when connecting or signing in using Facebook users must explicitly give you permission to use their email address. Since none of the friends gave you permission, their e-mail addresses are off limits. What this means is you can encourage the user to have their friends join as well, and make sure that when they sign up you include a request for their e-mail address.
I think you are not getting the email from friends because this is not even possible to get from Facebook`s Graph API.
Check this out:
Facebook Graph API, how to get users email?