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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mailwand-1.0.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

mailwand-1.0.0-py3.8.egg (7.7 kB view details)

Uploaded Egg

mailwand-1.0.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file mailwand-1.0.0.tar.gz.

File metadata

  • Download URL: mailwand-1.0.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for mailwand-1.0.0.tar.gz
Algorithm Hash digest
SHA256 fed7a0946f0a2b0f01b3ce5af87d88d800d84b47a583158914c701f031b52f29
MD5 1e163897932193513646cdcc002a3c5a
BLAKE2b-256 8b9a9c19c96c7455ac33fadedaaf1b61151fd858baa24faeefe57f26bdee88ad

See more details on using hashes here.

File details

Details for the file mailwand-1.0.0-py3.8.egg.

File metadata

  • Download URL: mailwand-1.0.0-py3.8.egg
  • Upload date:
  • Size: 7.7 kB
  • Tags: Egg
  • Uploaded using 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

File hashes

Hashes for mailwand-1.0.0-py3.8.egg
Algorithm Hash digest
SHA256 0a3db3a10a764be6c1e63bbe611e1039d7e3623cd0e2c7f5d7a7b8ac3759dafb
MD5 1ebe6b94a5347d1bdbc1ad598e01f4f1
BLAKE2b-256 3266650062b7976867f389f800f3127d8a1c0709db4e319b34351f509821be07

See more details on using hashes here.

File details

Details for the file mailwand-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: mailwand-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for mailwand-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1696acb7ac3e63b13d568ec99bd3e8f51235233d3eb80500e0a81da2ae0fcb0
MD5 f92c7a8aadad7eb05f4060068c82617b
BLAKE2b-256 0ccde2117eb2e6f25078620b6e76ce66f4610253d006188ab374efce9d1707e2

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

3 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page