HACKER Q&A
📣 thr0waway1

Create an app that sends an email with some text


Hi, I want to create an app that runs on a batch job. Say at 4am every morning, this app should start. It should take a snippet from a database/data store and email it to a set of people in a list/DB.

I am a technical non-programming PM. So I understand technology but its been many years since I actually coded something.

I dont want to integrate with Twilio or something for an enterprise grade feature. This is just to create a quick POC to evaluate product/market fit.

Like I said above, its been a while, and I would like to do this myself. Any guidance on where I could start? Is the O-1 model good enough now where it can create this entire app for me, and deploy it? :)

Looking for tips that are not, simply said, too hard.


  👤 panosfilianos Accepted Answer ✓
Maybe someone is more knowledgable but I think the biggest issue here is deliverability.

You'll probably have to use a reputable provider's API (eg. GMail, Twilio etc.) because otherwise the recipients' provider are likely to flag you as spam and people never see your email.


👤 xupybd
Most email providers have APIs now. This is probably one rest call. Super easy in most languages.

  Pick a language.
  Pick an email as a service. 
  Read the docs. 
  Extend an example for your needs
  Set-up your cron job

  Profit

👤 librasteve
In raku,

  use Net::SMTP;

  Net::SMTP.new('smtp.gmail.com', port => 587, ssl => True)

  .login('your-email@gmail.com', 'your-password')
  .send(
    :from('your-email@gmail.com'),
    :to('recipient@example.com'), 
    :subject('Daily Snippet'),   
    :body('A random snippet'))
  .quit;
Then,

  crontab -e
  0 4 * * * /path/to/raku /path/to/send-email.raku

👤 asciimov
This sounds like a CS 102 homework assignment. Break out a book on bash scripting an get to hacking.

👤 masteruvpuppetz
If you're Microsoft 365 subscriber, then u can set up a PowerAutomate job.

Benefit of this route is lots of youtube tutorials explaining this and written documentation.

Hope this helps.


👤 solardev
Can you be more specific about this "database/data store"? The nature of that will limit your options.

If it's just a big ol' CSV or something similar, you might be able to just use a nocode/lowcode tool like Airtable or Make.com to automate it in a few minutes.

If it's something particular SQL database that you need to write a query to extract data from, it gets a bit harder because you need to connect that layer to the automation layer and then connect that to a transactional email service with good deliverability.

If you can give a clearer picture of details, like what kind of data format it's in, how many people you need to send it to, how often will the underlying data change, etc., it would help narrow down the options. There are approx. infinite ways to build this, but it can be very simple or more complicated depending on the details.


👤 porlw
This can easily be done with a small shell script and standard linux commands.

   #!/usr/bin/bash
   
   MAILTEXT=$(grep "dbkey" db.txt)
   
   cat emails.lst|while read ADDR NAME
   do
      mail -s "Subject" $ADDR <
Schedule with cron.

👤 antonzorin
After the question I wonder what do you mean by technical PM?

👤 perteraul
While all of the answers are valid, another option that I don't see here is n8n. I used it for something very similar to your requirement and was able to run it for years without intervention.

👤 henricourdent
Windmill.dev can do that easily. You can set a cron schedule to trigger a flow that does exactly what you want. If you are not a programmer, you can pick scripts (steps of the flow) from existing list Windmill Hub library (example to send an email) and use AI for the code of your actual business logic (the database part). Apart from that, you don't have to worry about code and maintenance. It's self-hostable or for less than 1k executions per month, you can use the cloud version for free.

👤 oulipo
I would suggest either a platform like hosted Windmill.dev or other,

or val.town which has an AI assitant so you can use it even if you don't code


👤 orionblastar
In 1995 I made an MS Access database that had emails in a table and used MAPI with Eudora Pro to send emails. I called the database SPAM, Software Programmable Automatic Spammer. I refuse to make any more SPAM programs.

👤 kkfx
Well... In app terms you ask for a cronjob and msmtp wrapped in a simple script... The hard part for you would be not being in most spam list in few hours.

👤 slater
1) get a cheap-o webhost that offers cron job support

2) learn some PHP + MySQL

3) Use PHP's built-in 'mail()' function to send an e-mail

4) Set up a cron job that runs the PHP file at 4AM


👤 sfmz
DB trigger plus a call to Gmail API? o1 can probably handle that.

👤 michelsedgh
Yes o1 is really good even claude could do something like this, o1 just does it faster. I have made much more complex apps using both clause and now o1 cause o1 is faster, claude took me a lotta time but its absolutely possible. very easy actually. Good luck.