Skip to main content

MailWand

有天被未來的同事(應該啦?)問了
「怎麼發送嵌在email內的圖片啊? 不是附件喔!」

2020/09/10 - send inline image email -> send embed image email
2020/10/31 - send embed image email -> MailCrawler
2020/11/01 - MailCrawler -> MailSender
(MailSender被註冊了Orz...)
2020/11/01 - MailSender -> MailWand

名字好難想Rrrr...


Packages install

⚠️python version require >= 3.5⚠️

pip install mailwand

倘若安裝過程有問題請 pip install -r requirements.txt,應該都能解決。


使用方式 use

要先去設定 ./config/base.py 改設定喔!!!

直接搬 main.py 來講解

from mailwand import MailWand


if __name__ == '__main__':

    # variable is 'Optional parameters'
    # ↓這裡用來取代html中 '{Sir}' 是要被取代成 'people_name'
    variable = {'{Sir}': 'people_name'}
    # ↓如果是這樣就是會找 ./config/base.py 中設定的檔案們
    MailWand_1 = MailWand(variable)
    to_emails = ['ooo@gmail.com', 'xxx@gm.lhu.edu.tw']  # 要發送的對象們
    MailWand_1.send_to_mail(to_emails)  # 群發(但彼此看不到)
    MailWand_1.close()  # 關閉SMTP

    # variable is 'Optional parameters'
    # ↓這裡用來取代html中 '{Sir}' 是要被取代成 'people_name'
    variable2 = {'{Sir}': 'people_name2'}
    # ↓也可以直接指定屬性,目前一共9個,可在 ./config/base.py 中找到
    MailWand_2 = MailWand(
        variable2,
        header='這是第2種',  # email標題
        images_path='./images2/',  # 目前圖片只支援png
        html_file='./template2.html'  # html 檔案的位置
    )
    to_emails2 = ['ooo@gmail.com', 'xxx@gm.lhu.edu.tw']
    MailWand_2.send_to_multiple_recipients_mail(to_emails2)  # 群發(收件人會看到彼此)
    MailWand_2.close()  # 關閉SMTP

截圖

Imgur
Imgur


Application_password 獲取

Imgur Imgur Imgur Imgur Imgur

Metadata

Release files for mailwand 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mailwand 1.0.0
File Size Uploaded
mailwand-1.0.0.tar.gz 4.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for mailwand 1.0.0
File Interpreter ABI Platform
mailwand-1.0.0-py3.8.egg Legacy Egg format - - Details
mailwand-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.7 kB

Release files / mailwand-1.0.0.tar.gz

Download URL mailwand-1.0.0.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fed7a0946f0a2b0f01b3ce5af87d88d800d84b47a583158914c701f031b52f29
BLAKE2b-256 checksum
How to use checksums
8b9a9c19c96c7455ac33fadedaaf1b61151fd858baa24faeefe57f26bdee88ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

Release files / mailwand-1.0.0-py3.8.egg

Download URL mailwand-1.0.0-py3.8.egg
Size 7.7 kB
Tags Egg
SHA-256 checksum
How to use checksums
0a3db3a10a764be6c1e63bbe611e1039d7e3623cd0e2c7f5d7a7b8ac3759dafb
BLAKE2b-256 checksum
How to use checksums
3266650062b7976867f389f800f3127d8a1c0709db4e319b34351f509821be07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

Release files / mailwand-1.0.0-py3-none-any.whl

Download URL mailwand-1.0.0-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c1696acb7ac3e63b13d568ec99bd3e8f51235233d3eb80500e0a81da2ae0fcb0
BLAKE2b-256 checksum
How to use checksums
0ccde2117eb2e6f25078620b6e76ce66f4610253d006188ab374efce9d1707e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

Release history Release notifications | RSS feed

This release

1.0.0 This release

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page