Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

286
Views
how to use amazon ses email in next js?

am stuck with a problem, I want send email using amazon SES , suppose when I hit dynamicid.js file mail send method will work, can anyone tell me how can I implement send mail Functionality. If you have any question please free feel to ask.

getdatafromsheet() is the method where email body, status found

If any have any other method sending email via next js google sheet then let me know

SendMail.js

var AWS = require('aws-sdk');
   
 AWS.config.update({ region: process.env.AWS_REGION });
    
    export default function sendMail(Email) {
    
        var result;
        // Create sendEmail params 
        var params = {
            Destination: { /* required */
                CcAddresses: [
                    'harsalpatil512@gmail.com',
                    /* more items */
                ],
                ToAddresses: [
                    'harsalpatil512@gmail.com',
                    /* more items */
                ]
            },
            Message: { /* required */
                Body: { /* required */
                    Html: {
                        Charset: "UTF-8",
                        Data: "HTML_FORMAT_BODY"
                    },
                    Text: {
                        Charset: "UTF-8",
                        Data: "TEXT_FORMAT_BODY"
                    }
                },
                Subject: {
                    Charset: 'UTF-8',
                    Data: 'Test email'
                }
            },
            Source: 'skillup@eddytools.com', /* required */
            ReplyToAddresses: [
                'harsalpatil512@gmail.com',
                /* more items */
            ],
        };
    
        // Create the promise and SES service object
        var sendPromise = new AWS.SES({ apiVersion: '2010-12-01' }).sendEmail(params).promise();
    
        // Handle promise's fulfilled/rejected states
        sendPromise.then(
            function (data) {
                result = 'Success';
            }).catch(
                function (err) {
                   result = 'Failed';
                });
    }

DynamicId.js

import { getDataFromSheets } from "../../libs/sheets";
import sendMail from '../ses/sendmail';

export default function handler(req, res) {
  var data;
  getDataFromSheets()
    .then(sheet => {
      data = sheet.length
      for(var i = 0;i<data;i++){
        console.log(sheet[i+1].Email)
      }
    })
    .catch(err => console.log(err))

}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!