1

以前の会話と同様に、手動で Outlook のメールに返信しようとしています。しかし、以下のコードはいくつかのエラーを出しています: 受信者アドレスに送信できませんでした..メールを送った人に返送する方法を知る必要があります..

import win32com.client, datetime
from datetime import timedelta    

outlook =win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI") # to trigger outlook application
inbox = outlook.GetDefaultFolder(6) # 6 is used for the index of the folder
messages = inbox.Items  
message = messages.GetLast()# message is treated as each mail in for loop 
for message in messages:                                          
    if message.Subject=="request": # based on the subject replying to email
        #body_content = message.body  
        message.Reply()  
        message.Body = "shortly will be processed!!!"  
        message.Send()  
4

3 に答える 3

0

MailItem.Body は String であるため、呼び出し可能ではありません。参照ドキュメント @Akhilの答えの正しいコードは

    rplyall.Body = "your message here" + rplyall.Body
    rplyall.Send()
于 2021-07-30T13:26:05.660 に答える