I need directions/help on how to use curl with gmail smtp and OAuth2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 "xxxx@xxxxxxxxx" --mail-rcpt "yyyy@xxxxxxxx" --ssl -u xxxx@xxxxxxxxx:'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@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux