Sunday, September 24, 2017

raspberry pi常见命令

from boxsdk import Client, OAuth2
oauth = OAuth2(client_id='11111111111111', client_secret='22222222222', access_token="3333333333333333")
client = Client(oauth)
shared_folder = client.folder(
    folder_id='0',
).create_subfolder('shared_folder')
uploaded_file = shared_folder.upload('/path/to/filename')
shared_link = shared_folder.get_shared_link()

Installing


sudo apt-get install ssmtp
sudo apt-get install mailutils
Now edit the SSMTP configuration file

sudo nano /etc/ssmtp/ssmtp.conf
It needs to include this:

root=postmaster
mailhub=smtp.gmail.com:587
hostname=raspberrypi
AuthUser=AGmailUserName@gmail.com
AuthPass=TheGmailPassword
FromLineOverride=YES
UseSTARTTLS=YES
Save and exit

Sending an email


echo "Hello world email body" | mail -s "Test Subject" recipientname@domain.com