|
| 1 | +import yagmail |
| 2 | +import schedule |
| 3 | +import time |
| 4 | +import datetime |
| 5 | +import os |
| 6 | + |
| 7 | +# Input your information by chnaging string part from here--------------------- |
| 8 | + |
| 9 | +email = 'your_account@gmail.com' |
| 10 | +# used for email body (e.g. sincerely <myname>) |
| 11 | +your_name = 'your_real_name' |
| 12 | +recipient_name = 'John Doe' |
| 13 | +# Your application password can be used only after 2-step verification |
| 14 | +password = 'your_gmailpassword' |
| 15 | + |
| 16 | +# Recipient's birthday information |
| 17 | +today = datetime.date.today() |
| 18 | +birthday_list = { |
| 19 | + # Change John to recipient's name |
| 20 | + "John": { |
| 21 | + # Change john@example.com into real recipient's email |
| 22 | + "email": "john@example.com", |
| 23 | + # Change Month and Day of a birthday |
| 24 | + "birthday": datetime.date(today.year, 12, 31), |
| 25 | + "attachment": "/path/to/john_card.pdf" # Enter absolute path to a file if needed |
| 26 | + }, |
| 27 | + "Jane": { |
| 28 | + "email": "jane@example.com", |
| 29 | + "birthday": datetime.date(today.year, 8, 22), |
| 30 | + "attachment": None # 添付ファイルなし |
| 31 | + }, |
| 32 | + # Add other recipient from here |
| 33 | + } |
| 34 | +# If you want to change the content, modify below |
| 35 | +subject = f"Happy birthday {recipient_name}!" |
| 36 | +body = f"""Dear {recipient_name}, |
| 37 | +
|
| 38 | +Wishing you a very happy birthday filled with love, laughter, and joy! May all your dreams and aspirations come true. |
| 39 | +Looking forward to seeing you soon! Have a fantastic birthday! |
| 40 | +
|
| 41 | +Best wishes, {your_name}""" |
| 42 | +# --------------------------------------------------------------------------^^^ |
| 43 | + |
| 44 | + |
0 commit comments