Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Use SendGrid's API to send emails from Bing Ads Scripts
function main() {
// Get your own SendGrid API Key from
var SENDGRID_API_KEY='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';
var emailTo = "";
var subject = "About your Bing Ads account";
var emailBody = "Now you can send emails using Bing As Scripts. Thanks Optmyzr for the code sample!";
var headers = {
"Authorization" : "Bearer "+SENDGRID_API_KEY
var email = {"personalizations": [{"to": [{"email": emailTo}]}],"from": {"email": ""},"subject": subject,"content": [{"type": "text/plain", "value": emailBody}]};
var options = {
contentType: 'application/json',
'muteHttpExceptions': true,
var response = UrlFetchApp.fetch('', options);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.