推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
madNeal
V2EX  ›  Python

通过 win32 选定制定的邮件账户发邮件

  •  
  •   madNeal ·
    neal1991 · Jan 22, 2018 · 2245 views
    This topic created in 3068 days ago, the information mentioned may be changed or developed.

    通过 win32 可以发送邮件,但是好像不可以制定邮件账户,找了一圈发现可以通过SentOnBehalfOfName来发送邮件:

    def send_email():
        obj = client.Dispatch('Outlook.Application')
        new_mail = obj.CreateItem(0)
        new_mail.SentOnBehalfOfName= '[email protected]'
        new_mail.Subject = 'test'
        new_mail.display()
    

    但发觉发送的时候不能发送,发送会失败,错误提醒如下: 您不能代表其他发件人发送邮件,除非您有权这样做。请确认您是否代表正确的发件人发送邮件,或请求所需的权限。如果问题仍然存在,请与支持人员联系。 不知道大家有没有更完美的解决方案

    2 replies    2018-01-23 06:42:58 +08:00
    ysc3839
        1
    ysc3839  
       Jan 22, 2018 via Android
    准确来说这不是 Win32 的功能而是 Outlook 的功能。
    XiaoFaye
        2
    XiaoFaye  
       Jan 23, 2018
    当然不能直接改名发邮件,要服务器允许才可以吧?不然就很容易冒充大公司了呀。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5299 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 54ms · UTC 08:10 · PVG 16:10 · LAX 01:10 · JFK 04:10
    ♥ Do have faith in what you're doing.