- Login to Google Sheets
- Open a Blank Sheet
- Add a list of Emails to a Row of Cells
- Click on
Extensions
>Apps Script
- Open your
Editor
- Import code
emailEveryone(); // Call the emailEveryone function correctly here
}
function emailEveryone() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var emailRange = sheet.getRange('A1:A'); // Adjust this to match the exact range of emails
var emailValues = emailRange.getValues();
var subject = "Seed Funding Investment Opportunity"; // Your subject line
var plainMessage = "Hello,\n\nBest regards,\n[Your Name]"; // Plain-text fallback message
var htmlMessage = `
<h2>Hello World!</h2> // Introduction
<p>Abracadabra</p> // Paragraph
<p>Neater format</p>// Paragraph 2
<footer>
<p>Sincerely Bob</p>
</footer>
`;
// Loop through each email in the range and send the email
for (var i = 0; i < emailValues.length; i++) {
var emailAddress = emailValues[i][0];
if (emailAddress) { // Check if email is not empty
MailApp.sendEmail({
to: "[email protected]", // your email or list of emails goes here
subject: subject,
body: plainMessage, // Plain text fallback
htmlBody: htmlMessage // HTML formatted message
});
}
}
}
- Run
debug
tool to check for errors - Click
Deploy