Using the script below: #!/usr/bin/python # Import modules for CGI handlingimport cgi, cgitb # Import modules for email handlingimport smtplib # set header for cgiprint "Content-Type: text/html\n\n" # Create instance of FieldStorageform = cgi.FieldStorage() # Get data from fieldsname = form.getvalue('name')email = form.getvalue('email')subject = form.getvalue('subject')message = form.getvalue('message') # Send emailreceivers = ['email@gmail.com'] text = "From: me\n" + "To: Contact <email@gmail.com>\n" + "Subject: " + subject + "\nFrom: " + name + " <" + email + ">\n" + message + "\n" try:server = smtplib.SMTP("localhost")#'smtp.gmail.com', 587)server.sendmail("contact@server.heliohost.org", "email@gmail.com", text) #server.starttls()#server.login("email@gmail.com", "password")#server.sendmail("email@gmail.com", receivers, text)server.quit()#print "Successfully sent email"except:#print "Error: unable to send email"pass And I am still getting error 500 I tested and I am passing the right values for variables from form. If I execute the script as a regular program at my machine passing the values copied from alert dialog box the message is sent. I don't know why it is not working inside Apache.