从cli发送邮件的小程序包
climailsystem的Python项目详细描述
CLI邮件系统
这是一个简单的邮件系统,用于使用gmail api安全地发送邮件。您可以使用python-python包索引(pip)通过以下命令安装它
$ pip3 install climailsystem
您可以将此模块用作命令行工具,也可以将其用作python模块
CLI指南
^{pr2}$这将显示所有可用的有效命令
Usage: sendmail [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Commands:
deleteapicreds
mdetails
relogin
sendmessage
sendmessage-attach
udetails
命令参数
$ sendmail sendmessage --help
Usage: sendmail sendmessage [OPTIONS] EMAIL_ID_OF_SENDER SUBJECT MSSG
Options:
--help Show this message and exit.
模块指南
import sendmail
mssg = sendmail.sendmessage(email_address_of_sender,subject,mssg)
used for sending email without attachment
mssg_attach = sendmail.sendmessage(email_address_of_sender,subject,mssg,path_of_file_to_be_shared)
used for sending email with attachment
user_details = sendmail.userdetails()
used for checking details of user like email id, displaydetails
user_mssg_details = sendmail.usermessagedetails()
used for checking details of user messages like total number of messages, threads etc
logout = sendmail.login()
used for changing the user
delete_Creds = sendmail.deleteapicreds()
used for changing api creds
要使用此模块,您需要gmailapi的Api凭据,您可以使用client.json中的凭据,只需复制凭据并粘贴它,也可以在开发人员控制台创建自己的凭据。请注意,这是一次性过程,即您只需在第一次使用时输入凭证。当您第一次将此模块作为命令行界面运行,或将在您的项目中第一次导入此模块时,屏幕上将显示一条消息。在
Enter Creds
然后复制api凭据并将其粘贴到控制台上。在
- 项目
标签: