News for hackers. Stuff that matters.

Ask HN: 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.

( 18 comments | 4 points | on HN )
Re:Ask HN: Create an app that sends an email with some text by perteraul on Monday September 23, 2024 @04:05AM (#41623560)
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.
Re:Ask HN: Create an app that sends an email with some text by xupybd on Monday September 23, 2024 @03:15AM (#41623229)
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
Re:Ask HN: Create an app that sends an email with some text by asciimov on Monday September 23, 2024 @03:12AM (#41623203)
This sounds like a CS 102 homework assignment. Break out a book on bash scripting an get to hacking.
Re:Ask HN: Create an app that sends an email with some text by panosfilianos on Monday September 23, 2024 @02:34AM (#41622938)
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.

Re:Ask HN: Create an app that sends an email with some text by masteruvpuppetz on Monday September 23, 2024 @03:47AM (#41623439)
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.

Re:Ask HN: Create an app that sends an email with some text by porlw on Monday September 23, 2024 @03:13AM (#41623214)
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 <<EOT
   Dear $NAME

   $MAILTEXT

   EOT
   
   done
Schedule with cron.
Re:Ask HN: Create an app that sends an email with some text by nh2 on Monday September 23, 2024 @05:10AM (#41623988)
This is unsafe (glob injection).

Never use bash unless you know exactly what you are doing, and even then, better don't.

Even worse to recommend bash to somebody who already stated that they don't know what they are doing.

Just use Python for such scripts, it won't let you shoot yourself into the foot with surprising behavior.

Re:Ask HN: Create an app that sends an email with some text by antonzorin on Monday September 23, 2024 @02:46AM (#41623024)
After the question I wonder what do you mean by technical PM?
Re:Ask HN: Create an app that sends an email with some text by oulipo on Monday September 23, 2024 @02:53AM (#41623069)
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

Re:Ask HN: Create an app that sends an email with some text by nbbaier on Monday September 23, 2024 @02:58AM (#41623112)
I came to say val.town. It's trivial to do what you want to do
Re:Ask HN: Create an app that sends an email with some text by sfmz on Monday September 23, 2024 @12:35AM (#41622416)
DB trigger plus a call to Gmail API? o1 can probably handle that.
Re:Ask HN: Create an app that sends an email with some text by orionblastar on Monday September 23, 2024 @12:45AM (#41622449)
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.
Re:Ask HN: Create an app that sends an email with some text by michelsedgh on Monday September 23, 2024 @01:07AM (#41622544)
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.
Re:Ask HN: Create an app that sends an email with some text by slater on Monday September 23, 2024 @12:46AM (#41622450)
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

Re:Ask HN: Create an app that sends an email with some text by henricourdent on Monday September 23, 2024 @05:16AM (#41624020)
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.
Re:Ask HN: Create an app that sends an email with some text by kkfx on Monday September 23, 2024 @05:37AM (#41624157)
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.
Re:Ask HN: Create an app that sends an email with some text by librasteve on Monday September 23, 2024 @04:13PM (#41629980)
In raku,

  use Net::SMTP;

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

  .login('[email protected]', 'your-password')
  .send(
    :from('[email protected]'),
    :to('[email protected]'), 
    :subject('Daily Snippet'),   
    :body('A random snippet'))
  .quit;
Then,

  crontab -e
  0 4 * * * /path/to/raku /path/to/send-email.raku
Re:Ask HN: Create an app that sends an email with some text by solardev on Monday September 23, 2024 @09:17PM (#41632207)
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.