Python Scripts
Erscheinungsbild
Um mit python Mails zu versenden folgenden Script anpassen:
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email import Encoders
import os
mail_user = "noreplay@zeberliEDV.ch"
mail_pwd = "qbz8AxEbcjMHzp6i726f"
def mail(to, subject, text):
msg = MIMEMultipart()
msg['From'] = mail_user
msg['To'] = to
msg['Subject'] = subject
msg.attach(MIMEText(text))
#if you want to send the text as test and attached textfile, uncomment the following line
#msg.attach(MIMEText(text))
mailServer =smtplib.SMTP("smtp.nine.ch", 587)
mailServer.ehlo()
mailServer.starttls()
mailServer.ehlo()
mailServer.login(mail_user, mail_pwd)
mailServer.sendmail(mail_user, to, msg.as_string())
mailServer.close()
mail("backup@zeberliedv.ch",
"Datensicherung",
"Die Datensicherung hat nicht geklappt, bitte kontrollieren")