WebFaction
Community site: login faq

I have been working on small flask app sending an email using a web form whenever I send the form I am getting an 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"

This the code I have considering that I have created a mailbox and email on my webfaction which is what i am using to send the email here how I have setup on my code:

   EMAIL_HOST = 'smtp.webfaction.com'
   EMAIL_HOST_USER = 'my_webfaction_mail'
   EMAIL_HOST_PASSWORD = os.environ.get('USER') 
   DEFAULT_FROM_EMAIL = 'info@mywebsitename.com'
   SERVER_EMAIL = 'info@mywebsitename.com'

create mail object and pass it to application

mail = Mail(app)

app.route("/contact", methods=['GET', 'POST'])
def contact():
    form = ContactForm(request.form)
    if request.method == 'POST' and form.validate():

    #from_addr = "John Doe <john@doe.net>"
    to_addr = "info@mywebsitename.com"
    date = datetime.datetime.now().strftime( "%d/%m/%Y %H:%M" )

    msg = Message("Message from your visitor " + form.name.data,
                      sender='YourUser@NameHere',
                      recipients=['a.abdi4@gmail.com', 'a.abdi4@gmail.com'])
    msg.body = """
    From: %s <%s>,
    Date: %s,
    Subject: %s,
    Message:  %s
        """ % (form.name.data, form.email.data, date, form.subject.data, form.message.data)
    mail.send(msg)
    return "Your message has been successfully sent"
 return render_template('contact.html', contactform=form)

Whenever I submit it showing the error shown here once again:

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.

asked 01 Jul '16, 11:40

Abdi Ahmed
1113
accept rate: 0%


I also see the following error in your app's error log in ~/logs/user:

SMTPAuthenticationError: (535, '5.7.0 Error: authentication failed: authentication failure')

Are you certain that you're using the correct SMTP username and password? The username needs to be the name of a WebFaction mailbox (not an email address), and the password needs to be the password assigned to that mailbox.

permanent link

answered 01 Jul '16, 23:17

seanf
12.2k31836
accept rate: 37%

Seanf,

Thank you for your reply I tried to reset the password of my email making sure that everything is OK, but when I re-run the application and looked error logs it is showing:

[Sat Jul 02 10:43:27.504430 2016] [core:notice] [pid 18362:tid 140607978768256] AH00094: Command line: '/home/aabdi406/webapps/somweather/apache2/bin/httpd.worker -f /home/aabdi406/webapps/somweather/apache2/conf/httpd.conf'

What does this error mean ? and when the form is submitted the web page is showing:

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

Regards Abdi

(02 Jul '16, 11:00) Abdi Ahmed

Hello,

It looks like this is not the complete log. Can you please post a ticket from your WebFaction hosting control panel, so that we can look into this?

(02 Jul '16, 13:50) dimitari
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×8

question asked: 01 Jul '16, 11:40

question was seen: 1,118 times

last updated: 02 Jul '16, 13:50

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM