Send an email using Apps Script

To send an email using Apps Script, you can use the MailApp.sendEmail() method. Here’s an example code snippet:

function sendEmail() {
  var recipient = '[email protected]'; // Replace with the recipient's email address
  var subject = 'Test Email'; // Replace with the desired subject of the email
  var body = 'This is the body of the email.'; // Replace with the desired body of the email
  
  MailApp.sendEmail(recipient, subject, body);
}

In this code, the sendEmail function sends an email using Apps Script. You need to specify the recipient’s email address by replacing '[email protected]' with the actual email address.

The subject variable should contain the desired subject of the email. In this example, it’s set to 'Test Email', but you can change it to any subject you want.

Similarly, the body variable should contain the desired body of the email. In this example, it’s set to 'This is the body of the email.', but you can modify it to include the content you want.

The MailApp.sendEmail() method is called with the recipient, subject, and body as arguments. This method sends the email using the default account associated with the script.

You can call the sendEmail function from another function or set up a trigger to execute it based on your needs. When executed, it will send an email to the specified recipient with the specified subject and body.

Please note that the sender’s email address will be the email address associated with the Google account that owns the script.

Feel free to modify the code to suit your specific requirements, such as adding CC or BCC recipients, including HTML content in the email, or configuring additional options using the optional parameters of the sendEmail() method.

Pamai Tech
Turning ideas into Reality

Products

Office Add-in

Enterprise Solutions

Cloud Consulting

UI UX Design

Data Transformation

Services

FAQ's

Privacy Policy

Terms & Condition

Team

Contact Us

Company

About Us

Services

Features

Our Pricing

Latest News

© 2023 Pamai Tech