GmailApp.sendEmail() won't send email with a Bitly URL in body

57 Views Asked by At

I have a Google apps script which sends an email with a long URL and a Bitly shortened one. However the GmailApp.sendEmail function silently fails if I include a Bitly URL. Simple example of problem code:

function myFunction() {

var sMail = "(my email address)";
var longURL = "https://www.google.com";
var shortURL = "(bitly URL)";


// Send email with information
  GmailApp.sendEmail( 
      sMail, 
      "URL Send Test",
      "Original URL: " + longURL + "\n" +
      "Short URL: " + shortURL
    );

}

This code executes without error, but I never receive the email or any notification that it was blocked. If I remove shortURL from the body then email is received.

Obviously these shortened links are a source of abuse (in fact I can't include it in my post) but is there a way around this? My script generates a long custom URL and shortening it is an important function.

Thanks for any suggestions.

0

There are 0 best solutions below