0

I write one Script for add members to a Google Group. The data is write into my website, saved into Google Sheets and this sheet launch the script for add the member to the group.

The code is working fine, but only in some cases. Generally, the adresses with @hotmail are rejected with this message:

errorException: The email is invalid

I think there is one problem with @hotmail and another adresses. I migrated one list from Mailchimp to Google Groups with the same process, and multiple email adresses from @hotmail were rejected.

These email adresses not are invalid, the reports at Mailchimp indicated that the messages to those addresses were delivered.

In the past week alone, about five @hotmail addresses were rejected. They were real people trying to subscribe to my list, including people I have had communication with using those @hotmail email addresses. So I'm sure there is a problem in Google Workspace regarding @hotmail addresses. The same happens with a lot of addresses with @outlook, and with adresses of some custom domains.

How I can solve this.

The code I'm using is here:

function addUsertoGroup(userEmail) {
  var userEmail = userEmail.toLowerCase();
  var groupId = "My-Group@example.com";
  var group = GroupsApp.getGroupByEmail(groupId);
  try { 
    var hasMember = group.hasUser(userEmail); 
    if (!hasMember){
          var newMember = {email: userEmail, role: "MEMBER"};
          var mStatus=AdminDirectory.Members.insert(newMember, groupId); 
          Logger.log(" inserted: "+mStatus.email+"\n");
          return true; 
    }else{
          Logger.log(userEmail+" exists\n"); 
          return false;
    }
  } catch(e) {
          Logger.log(userEmail + " error"+e+"\n");
          return false; 
  }
}

This is one error example in the Log:

enter image description here

A. Cedano
  • 557
  • 7
  • 39
  • Hello there, can you confirm you are trying to insert that specific email address? I tried to replicate your scenario but I was able to successfully add the members. Moreover, does this happen with all the @ hotmail, @ outlook emails, or just with some specific ones? – ale13 Jan 04 '21 at 10:20
  • @ale13 the problem is with some specific ones. I write one script saving into one new sheet all rejected emails. Into one list of 2,000 members i have about 300 rejected. There are email with `@hotmail, @outlook, @custom-domains` ... And there are another adresses that are inserted without problem. The adresses are not erroneus, some users are writing me asking why they aren't receiving emails of the list. – A. Cedano Jan 04 '21 at 10:58
  • Do you also use a code for getting the email addresses? If so, can you please post it here as well? – ale13 Jan 04 '21 at 13:38
  • @ale13 i'm getting the email adresses from Google Sheets. No problem with this code, it works, and the email adresses are valid. If I try to add one of these rejected adresses directly i'm having the same error, then, is not problem of the previous code. – A. Cedano Jan 04 '21 at 15:02
  • I suggest you file this on Google's [Issue Tracker](https://developers.google.com/issue-tracker) in this situation since what you are encountering might be an issue. – ale13 Jan 11 '21 at 08:30

0 Answers0