Install software:

opkg update
opkg install python-openssl
nano /mnt/sda1/gmail.py
#!/usr/bin/python
import smtplib
from email.mime.text import MIMEText
USERNAME = "xxxxxx@gmail.com"
PASSWORD = "xxxxxx"
MAILTO  = "you@yourmail.com"
msg = MIMEText('Hello,\nMy name is Yun, \nhow are you')
msg['Subject'] = 'Mail from Yun'
msg['From'] = USERNAME
msg['To'] = MAILTO
server = smtplib.SMTP('smtp.gmail.com:587')
server.ehlo_or_helo_if_needed()
server.starttls()
server.ehlo_or_helo_if_needed()
server.login(USERNAME,PASSWORD)
server.sendmail(USERNAME, MAILTO, msg.as_string())
server.quit()
chmod 755 /mnt/sda1/gmail.py
/mnt/sda1/gmail.py

 

Comments powered by CComment