Lo script e -mail SMTP non funziona su Mac ma funziona su Windows
Domanda
Ho del codice usato per inviare e -mail. Funziona su Windows ma quando provo a eseguirlo su un Mac (con lo stesso accesso utente di Windows Machine), non invia un'e -mail o restituisce errori.
Qualcuno ha qualche esperienza con questa cosa, o esempi, suggerimenti, soluzioni PLS?
import smtplib
import mimetypes
from email import encoders
from email.message import Message
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import platform
SERVER = "mail.myCompany.co.za"
COMMASPACE = ', '
SUBJECT = "testing"
TEXT = "mac dev test\n\nSent from: " + platform.platform()
TO = [ 'jared.glass@myCompany.co.za' ]
FROM = "jared.glass@myCompany.co.za"
# connect to the server
smtp = smtplib.SMTP( SERVER )
smtp.ehlo()
# if attachments are too big, try gain and just add them as links
# Create the container (outer) email message.
msg = MIMEMultipart()
msg['Subject'] = SUBJECT
msg['From'] = FROM
msg['To'] = COMMASPACE.join(TO)
msg.attach( MIMEText( TEXT , 'plain') )
smtp.sendmail( FROM , TO , msg.as_string() )
smtp.close()
print(" ---- SUCCESS ---- mail sent ---- ")
Nessuna soluzione corretta
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow