r/webdevelopment • u/Danah0101 • 7d ago
Newbie Question Web application that sends emails
Hello everyone, I have a web application and one of its functions is designed to dispatch real emails. I realize this is a beginner question, but I genuinely need assistance. Is there a tool or website I can integrate into my site that sends real emails in the simplest way possible?
My website is built using Python, Flask, HTML, CSS, JavaScript, and SQLite.
Its a personal project. Thank you!
0
Upvotes
6
u/franky_1017 7d ago
I use resend.com, works well for my websites
1
u/ghijkgla 6d ago
What kind of emails?
2
u/Proper-Agency-1528 6d ago
You can make SMTP calls to your email server and send and receive emails that way. You have to have an email account first, though.
If you're sending bulk emails, e.g., for marketing, then a retailing service like resend.com makes sense as it keeps your original domain safe from spam filters. For occasional emails sent in small numbers, it's free.
Ask ChatGPT, Claude, or Gemini.
1
u/a-dot-in-the-sky 6d ago
you mean, a form in your web application that user can fill-in and send email to yourself or to any email that is set on the form?
check out this: https://formspree.io/ not sure if it fits your requirements
1
u/Some-Seaweed6858 7d ago
You'll want to use the SMTP protocol to send emails, which needs a relay and some DNS configuration.
You can develop your solution with Mailpit running locally as an SMTP relay, and then connect it to a real service like SMTP2GO or Brevo.
1
u/erroneousbosh 7d ago
You've got a few things to break down here. You need something to actually take the thing from your site, and you need to be able to send to an SMTP server.
Let's leave setting up SMTP as not really in scope for your question.
There are Python libraries that will handle sending an email to an SMTP server for you. You probably don't want to just call those from a web request, though! The server might take some time to respond and that will make your app slow.
Instead, you'll want to send it off to a task queue. Fortunately, there's a library called "Celery" that'll do this. Your Flask app pushes a message to Celery via Redis, Celery goes off and does the work, and notifies your app later that the email is sent.
If you just want to get in and rob some code out of another project that already does this, I run a couple of forums on FlaskBB which uses exactly this pattern for sending signup emails.
0
u/sleekpixelwebdesigns 6d ago
I recommend Fastmail is about $60 per year
0
u/Tight-Book-7533 6d ago
Firstly, I will recommend against setting up your own email server. For transactional emails, like password resets, etc, I have used both Sendgrid and Mailgun with good results. They both have a pretty easy API for sending emails. Make sure to keep your API key secure as they are sought after by spambots trawling through Github, etc.
0
u/earth-dragon-666 6d ago
Use an api service, your own smtp gets rejected often by the mail mafia