Beim Hinzufügen von CC-Empfängern in win32com mit Python wird ein Fehler angezeigtPython

Python-Programme
Anonymous
 Beim Hinzufügen von CC-Empfängern in win32com mit Python wird ein Fehler angezeigt

Post by Anonymous »

Ich möchte mithilfe von Python Win32com automatisierte E-Mails aus meinem Outlook an einige E-Mail-Adressen senden.
Dies ist der Code, den ich verwende -

Code: Select all

def Emailer(text, subject, recipient):
import win32com.client as win32
import os

outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = recipient
cc_address = 'my_email@email.com'
# mail.CC = f""
mail.Subject = subject
mail.HtmlBody = text
print("To:", mail.To)
###

# attachment1 = os.getcwd() +"\\file.ini"
#
# mail.Attachments.Add(attachment1)

###
mail.Send()

MailSubject= "Auto test mail"
MailInput= " This is test mail"
MailAdress="my_email@email.com;another_person@email.com"
Emailer(MailInput, MailSubject, MailAdress )
Ich kann die E-Mail erfolgreich senden, wenn mail.CC nicht definiert/kommentiert ist.
Aber wenn ich Empfänger in mail.CC hinzufüge . Ich erhalte die folgende Fehlermeldung -

Code: Select all

2147352567, 'Exception occurred.', (4096, 'Microsoft Outlook', 'The object does not support this method.', None, 0, -2147352567), None)
Gibt es eine andere Möglichkeit, CC-Empfänger hinzuzufügen?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post