[ Free ] Make Custom email sender API with google apps script

Let’s make a custom email sender API by google apps script.
By this API you can send a custom email also you can send email templates.

Features and usages
  • Totally free
  • You can send any kind of email template
  • You can connect with your google sheets.
  • Much more
Let's make the API first
    1. Open google drive in your favorite browser. Click on the “New”, then select “google apps script”.
    1. You can rename the file if you want. (optional).
  1. Delete all pre-code.
    1. Past the google apps script code here which provide in below.
  1. Click the save icon.
  2. After saving the code you don’t see any alert icon on this part.(see in Image)
  3. Click on the deploy button.
Google Apps Script Code
// kodular coder
//kodularcoder.web.app
function doGet(){
  return ContentService.createTextOutput("online");
}

function doPost(e) {
  var body = e.parameter.body;
  MailApp.sendEmail({
    to: e.parameter.to,
    subject: e.parameter.subject,
    body: body,
    htmlBody: body
  });
  return ContentService.createTextOutput("success");
};
  1. Click on “Done”.
  2. All done.
Let's move to kodular
    1. Open your :kodular:kodular project.
  1. For testing, you need 3 components. ( Web, Button and Notifier );
  1. Copy our block in your project, and it’s ready to test.
    NOTE: Don’t change the white mark section ( ! importent );

Details: We send a post request in API by web component. If our request succeeded then we got “success” as a response content. Otherwise, the request is failed due to some basic reasons. Such as internet connection error, wrong email address, wrong API, etc.

If I have done something wrong, please let me know so that I can correct my mistake. Because I am not a professional.

Thank you all :blue_heart: :blue_heart:

11 Likes

Nice work @RDR_SA

1 Like

Thanks for this guide, This guide brought my app back to live. :+1:

It is worth noting that:

  • all emails will be sent from the gmail account that created/authenticated the script
  • A "free" google account has a quota of 100 emails per 24 hours

good leadership