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
+58
View File
@@ -0,0 +1,58 @@
# 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()
# Step 4 - Declare SMTP credentials
password = "Cloud%67HgDd4569djs5"
username = "cloudserver@suy.nu"
smtphost = "mail.mijndomein.nl"
# Step 5 - Declare message elements
msg['From'] = "cloudserver@suy.nu"
msg['To'] = "ignace@suy.nu"
msg['Subject'] = "www.suy.nu - system message"
# Step 6 - Add the message body to the object instance
msg.attach(MIMEText(self.message, 'plain'))
# Step 7 - Create the server connection
server = smtplib.SMTP(smtphost)
# Step 8 - Switch the connection over to TLS encryption
server.starttls()
# Step 9 - Authenticate with the server
server.login(username, password)
# Step 10 - Send the message
server.sendmail(msg['From'], msg['To'], msg.as_string())
# Step 11 - Disconnect
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()