Contact form template as a streamlit multipage app

Hello streamlit developers.

I was toying with the idea of implementing a contact form for one of my apps and had the idea that this might be useful to others as a template.


Live demo. Documentation.

While I have seen at least one way of implementing contact forms using external tools, this template uses exclusively python libraries and streamlit elements and should fit seamlessly with already developed or new apps.

The template contains strict email validation through email-validator and customizable CAPTCHA generation using python’s captcha library. Messages are processed using the smtplib SMTP protocol client. To successfully process messages, you will need to set up an SMTP server (this can be done even with Gmail).

This SMTP server will send the message to the email address of your choice, and you have the possibility to enable a confirmation email being sent to the sender’s contact email address.

The template is highly customizable and can be easily edited to specific needs (e.g. it would be easy to add a “Subject” input box, if it is a needed feature, or force a limit in message characters with st.text_area’s max_chars, etc.)

Hope this is useful to someone.

Cheers!

7 Likes

This is great - thank you!

1 Like