Hello all,
As of 04/29/2025, my website's configuration to send SMTP email via my Google Workspace account stopped working. My website is no longer able to send emails (receipts, contact form submissions, etc...)
Firstly, is this something that was planned, and if not how can I resolve the issue and regain that functionality on my website?
In the meantime, I have asked my developer to do some research and she informed me that I might have to migrate to use GMail API with oAuth in order to regain this functionality on my website. My developer was able to get oAuth / REST requests working to refresh the token and hit the GMail API to send email on an IIS development server with a client secret / client ID setup obtained from Developer Console and a refresh token obtained from Google's oAuth playground website. It also works in PostMan, however that same code fails when deployed to my live website.
The error she is getting is fairly obscure, and doesn't help diagnose the true issue. It's happening on the line that executes the REST request to refresh the token and assigns it to a variable. The exact error text is "Value cannot be null. Parameter name: s"
A code snippet is shown below (with variables containing the values being passed):
try
{
var client = new RestClient();
var request = new RestRequest(TokenURL, Method.Post);
request.AlwaysMultipartFormData = true;
request.AddParameter("client_secret", ClientSecret);
request.AddParameter("client_id", ClientID);
request.AddParameter("grant_type", "refresh_token");
request.AddParameter("refresh_token", RefreshToken);
RestResponse response = client.Execute(request);
JObject json = JObject.Parse(response.Content);
return json["access_token"]?.ToString();
}
catch (System.Exception ex)
{
myErrorLog.RecordError("GetToken", 1, ex.Source, ex.Message);
return "";
}
My developer has been able to determine via debugging code (not included) that the error is happening on the RestResponse response = client.Execute(request); line. This prevents any further requests from being made as there is no token being re-generated when trying to send an email. And none of the parameters are named "s".
Thank you in advance for your help with figuring this out!
Hello all - I am posting an update here.
My developer went back to my Google account and turned on 2fa, then set up an app password. The old method for sending email began working again for about 10 minutes, then began to fail once more.
This is a critical issue, as my website is extremely dependent upon emails going out with receipts, but nothing is working.
Thank you in advance for any assistance!