current position:Home>How to send payslips in Python
How to send payslips in Python
2022-02-01 13:10:55 【zwf193071】
This is my participation 11 The fourth of the yuegengwen challenge 5 God , Check out the activity details :2021 One last more challenge
Preface
Every payday , Financial pain is ~~
No literary talent , However, the above sentence shows that when people keep repeating their work , A painful state of mind .
As procedural apes, we , Of course, you have to stand up at this time , Don't talk much , Roll up your sleeves and write .
Copy code
Code implementation
import openpyxl
from openpyxl import load_workbook
import yagmail
import keyring
from datetime import *
wb = load_workbook("test.xlsx", data_only = True)
sheet = wb.active
yagmail.register("[email protected]", "AAA")
pwd = keyring.get_password("yagmail", "[email protected]")
yag = yagmail.SMTP(user="[email protected]", host="smtp.qq.com", password=pwd)
count=0
table_header="<thead>"
for row in sheet:
count += 1
if count == 1:
for cell in row:
if cell.column != "B":
table_header += f"<th>{cell.value}</th>"
table_header += "</thead>"
continue
else:
row_text = ""
for cell in row:
if cell.column == "B":
continue
row_text += f"<td>{cell.value}</td>"
row_text += "</tr>"
name = row[0].value
email = row[1].value
contents = f""" <h3>{name}, hello: </h3> <p>Please check your {date.today().year}-{date.today().month} salary.</p> <table border="1px solid black">{table_header}{row_text}</table> """
yag.send(f"{email}", f"Wenfang limited company{date.today().year}-{date.today().month}-salary status", contents)
print(f"{name} sent ")
print(" All sent ")
Copy code
Be careful :yagmail.register("[email protected]", "AAA"), The second parameter "AAA" It is necessary to go to QQ Obtained from mailbox settings , The steps are shown in the figure below :
- Click Settings
- Switch to 【 Account 】 One column , Click to open SMTP
There will be a shell layer , Prompt to send information to the corresponding account , After the SMS is sent successfully , You can get the parameters "AAA" Value
function python file , The following results appear
Check E-mail , New messages have been found
copyright notice
author[zwf193071],Please bring the original link to reprint, thank you.
https://en.pythonmana.com/2022/02/202202011310534776.html
The sidebar is recommended
- Python logging log error and exception exception callback method
- Learn Python quickly and take a shortcut~
- Python from 0 to 1 (day 15) - Python conditional judgment 2
- Python crawler actual combat, requests module, python to capture headlines and take beautiful pictures
- The whole activity collected 8 proxy IP sites to pave the way for the python proxy pool, and the 15th of 120 crawlers
- Why can't list be used as dictionary key value in Python
- Python from 0 to 1 (day 16) - Python conditional judgment 3
- What is the python programming language?
- Python crawler reverse webpack, a real estate management platform login password parameter encryption logic
- Python crawler reverse, a college entrance examination volunteer filling platform encrypts the parameter signsafe and decrypts the returned results
guess what you like
-
Python simulated Login, selenium module, python identification graphic verification code to realize automatic login
-
Python -- datetime (timedelta class)
-
Python's five strange skills will bring you a sense of enrichment in mastering efficient programming skills
-
[Python] comparison of dictionary dict, defaultdict and orderdict
-
Test driven development using Django
-
Face recognition practice: face recognition using Python opencv and deep learning
-
leetcode 1610. Maximum Number of Visible Points(python)
-
Python thread 03 thread synchronization
-
Introduction and internal principles of Python's widely used concurrent processing Library Futures
-
Python - progress bar artifact tqdm usage
Random recommended
- Python learning notes - the fifth bullet * class & object oriented
- Python learning notes - the fourth bullet IO operation
- Python crawler actual combat: crawl all the pictures in the answer
- Quick reference manual of common regular expressions, necessary for Python text processing
- [Python] the characteristics of dictionaries and collections and the hash table behind them
- Python crawler - fund information storage
- Python crawler actual combat, pyteseract module, python realizes the visualization of boos direct employment & hook post data
- Pit filling summary: Python memory leak troubleshooting tips
- Python code reading (Chapter 61): delaying function calls
- Through the for loop, compare the differences between Python and Ruby Programming ideas
- leetcode 1606. Find Servers That Handled Most Number of Requests(python)
- leetcode 1611. Minimum One Bit Operations to Make Integers Zero(python)
- 06python learning notes - reading external text data
- [Python] functions, higher-order functions, anonymous functions and function attributes
- Python Networkx practice social network visualization
- Data analysis starts from scratch, and pandas reads and writes CSV data
- Python review (format string)
- [pandas learning notes 01] powerful tool set for analyzing structured data
- leetcode 147. Insertion Sort List(python)
- apache2. 4 + windows deployment Django (multi site)
- Python data analysis - linear regression selection fund
- How to make a python SDK and upload and download private servers
- Python from 0 to 1 (day 20) - basic concepts of Python dictionary
- Django -- closure decorator regular expression
- Implementation of home page and back end of Vue + Django tourism network project
- Easy to use scaffold in Python
- [Python actual combat sharing] I wrote a GIF generation tool, which is really TM simple (Douluo continent, did you see it?)
- [Python] function decorators and common decorators
- Explain the python streamlit framework in detail, which is used to build a beautiful data visualization web app, and practice making a garbage classification app
- Construction of the first Django project
- Python crawler actual combat, pyecharts module, python realizes the visualization of river review data
- Python series -- web crawler
- Plotly + pandas + sklearn: shoot the first shot of kaggle
- How to learn Python systematically?
- Analysis on several implementations of Python crawler data De duplication
- leetcode 1616. Split Two Strings to Make Palindrome (python)
- Python Matplotlib drawing violin diagram
- Python crawls a large number of beautiful pictures with 10 lines of code
- [tool] integrated use of firebase push function in Python project
- How to use Python to statistically analyze access logs?