On 2020-03-16 16:23, ToddAndMargo via curl-users wrote:
Hi All,

Does anyone have a link to a good set of directions on
how to use curl with smtp.gmail.com and Oauth2?

Many thanks,
-T

Help!

Fedora 31
curl-7.66.0-1.fc31.x86_6

gMail: less secure apps are purposefully off as gMail will be dropping support for less secure in June.

I can not find anything our there on how to use curl with
gmail and OAuth2.

I did figure out how to get my token:

  First, you must obtain your Client ID and Client Secret by using
  a browser.  Open the following

     https://console.developers.google.com/
     --> Credentials (left column)
       --> "+ Create Credentials"  (button at the top)
          --> OAuth client ID
            --> Application Type = Web Application
              --> Name: give it a unique name
                --> Save
                  --> copy the resulting Client ID and Client Secret
                      into the corresponding variables below.
                      And independently save these values as well

  The script will then take you to a browser page where you will
  sign into your google account to receive your
  authorization code, which you save

Also note that you have to tell gmail that the suspecious activity is you.
  gmail will send you a letter with a link to follow


client_id="aaaa"  # from the web page
client_secret="bbb" # also from the web page
scope="https://www.googleapis.com/auth/drive";
endpoint="https://accounts.google.com/o/oauth2/auth"=code&scope=$scope%access_type=offline&redirect_uri=urn:ietf:wg:oauth:2.0:oob";
url="$endpoint?client_id=$client_id&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=$scope&response_type=code"



This is what I have so far

$ cat mail.txt | curl -vvv smtp://smtp.gmail.com:465 --mail-from "x...@gmail.com" --mail-rcpt "y...@zoho.com" --ssl -u x...@gmail.com:'zzzz' -oauth2-bearer 'big long thing'

% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying 74.125.142.109:465...
* TCP_NODELAY set
* Connected to smtp.gmail.com (74.125.142.109) port 465 (#0)
0 0 0 0 0 0 0 0 --:--:-- 0:00:09 --:--:-- 0* response reading failed 0 0 0 0 0 0 0 0 --:--:-- 0:00:10 --:--:-- 0
* Closing connection 0
curl: (56) response reading failed
*   Trying 0.0.0.4:80...
* TCP_NODELAY set
<hangs for about five minutes>
* connect to 0.0.0.4 port 80 failed: Connection timed out
* Failed to connect to 4 port 80: Connection timed out
* Closing connection 1
curl: (7) Failed to connect to 4 port 80: Connection timed out
_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org

Reply via email to