Forums

SMTP Server settings for a paid webapp

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?

There's no way for us to know what the correct settings for your SMTP server are. You should use the settings that your mail server requires and there's no way for us to get that information.

Can pythonAnywhere provide SMTP services?

No, we don't provide that. The most popular options among our customers are Google's Gmail SMTP services, MailGun, and Sendgrid.