I have the following Python function:
# Params are from an html form parsed by Flask
def sendEmail(firstname, lastname, fromaddr, message):
smtpServer = 'smtp.mycustomurl.com.au'
toaddrs = "myemail@address.com"
message = """From: %s %s <%s>
To: My Name <%s>
Subject: Contact Page Email
%s""" % (firstname, lastname, fromaddr, toaddrs, message)
try:
smtpObj = smtplib.SMTP(
smtpObj.sendmail(fromaddr, toaddrs, message)
log("Successfully sent email: ", message)
except smtplib.SMTPException as e:
log("Error: unable to send email", e)
However, when I fill out the html form and click send, the page crashes with:
"500 Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application."
My guess is my SMTP server settings are wrong? but what are the correct settings?