I am using the following code to launch the e-mail client with pre-defined fields. The e-mail client launches as expected when I test on my local machine, but not on the production server. On the production server I simply get the redirect to '/'. Any suggestions on what could cause the e-mail client to launch? I tested on all browsers I, and did not see any difference in behaviour.
@app.route('/errorform', methods=['GET', 'POST'])
def errorform():
form = ErrorForm()
logs = str(open(file, "r").readlines()[int(file_len(file))]).rstrip()
if form.validate_on_submit():
if form.includeLogs.data == False:
webbrowser.open('mailto:test@mail.com?subject=Feedback&body=<insert your message here>')
return redirect('/')
else:
webbrowser.open('mailto:test@mail.com?subject=Feedback&body=<insert your message here> \n\n Logs: %s' % (logs))
return redirect('/')
return render_template('main.html', form=form, show_results=0, page = 'errorform')
Ok, since you've got an answer to the first question, here comes a suggestion to the second problem: just redirect to the mailto:
URL:
@app.route('/errorform', methods=['GET', 'POST'])
def errorform():
form = ErrorForm()
logs = str(open(file, "r").readlines()[int(file_len(file))]).rstrip()
if form.validate_on_submit():
if form.includeLogs.data == False:
return redirect('mailto:test@mail.com?subject=Feedback&body=<insert your message here>')
else:
return redirect('mailto:test@mail.com?subject=Feedback&body=<insert your message here> \n\n Logs: %s' % (logs))
return render_template('main.html', form=form, show_results=0, page = 'errorform')
Worked For Me™ here.