first commit

This commit is contained in:
2025-03-24 21:33:34 +00:00
commit 4a183d6f90
34 changed files with 885 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
# call this program with:
# echo "blah" | python3 sendAuthMail.py
# cat <filename.txt> | python3 sendAuthMail.py
# python3 sendAuthMail.py 'blah'
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import smtplib
import sys
class SendOff():
def __init__(self, message):
self.message = message
def ignace(self):
# Step 2 - Create message object instance
msg = MIMEMultipart()
smtp_ssl_host = 'smtp.strato.com' # smtp.mail.yahoo.com
smtp_ssl_port = 465
# Step 4 - Declare SMTP credentials
password = "Cloud%67HgDd4569djs5"
username = "cloudserver@suy.nl"
sender = 'cloudserver@suy.nl'
targets = ['ignace@suy.nl']
# msg = MIMEText('Hi, how are you today?')
msg.attach(MIMEText(self.message, 'plain'))
msg['Subject'] = "www.suy.nl - system message"
msg['From'] = sender
msg['To'] = ', '.join(targets)
server = smtplib.SMTP_SSL(smtp_ssl_host, smtp_ssl_port)
server.login(username, password)
server.sendmail(sender, targets, msg.as_string())
server.quit()
if __name__ == "__main__":
body = ''
if len(sys.argv) > 1:
body = sys.argv[1]
else:
for line in sys.stdin:
body += line
if len(body) > 0:
s = SendOff(body)
s.ignace()