@@ -299,7 +299,7 @@ function getUserFriendlyError(error: unknown): string {
299299 message . includes ( "authentication" ) ||
300300 message . includes ( "Username and Password not accepted" )
301301 ) {
302- return "Identifiants OAuth invalides ou token expiré. Veuillez reconnecter ce compte ." ;
302+ return "Invalid OAuth credentials or expired token. Please reconnect this account ." ;
303303 }
304304
305305 // Detect connection/timeout errors
@@ -309,7 +309,7 @@ function getUserFriendlyError(error: unknown): string {
309309 message . includes ( "ECONNREFUSED" ) ||
310310 message . includes ( "ENOTFOUND" )
311311 ) {
312- return "Impossible de se connecter au serveur SMTP. Veuillez réessayer plus tard ." ;
312+ return "Cannot connect to SMTP server. Please try again later ." ;
313313 }
314314
315315 // Detect rate limiting
@@ -318,7 +318,7 @@ function getUserFriendlyError(error: unknown): string {
318318 message . includes ( "throttl" ) ||
319319 message . includes ( "429" )
320320 ) {
321- return "Trop de requêtes. Veuillez réessayer plus tard ." ;
321+ return "Too many requests. Please try again later ." ;
322322 }
323323
324324 // Default: return the original message but truncated
@@ -662,8 +662,35 @@ async function resolveSenderOptions(authorization: string, userEmail: string) {
662662 }
663663
664664 for ( const source of sources ) {
665+ const expiresAt = source . credentials . expiresAt ;
666+ const nowMs = Date . now ( ) ;
667+ console . log (
668+ "[OAuth] Checking source:" ,
669+ source . email ,
670+ "- type:" ,
671+ source . type ,
672+ "- expiresAt:" ,
673+ expiresAt ,
674+ "- now:" ,
675+ nowMs ,
676+ "- isExpired:" ,
677+ expiresAt && expiresAt <= nowMs ,
678+ ) ;
679+
665680 const credentialIssue = getSenderCredentialIssue ( source ) ;
681+ console . log (
682+ "[OAuth] Credential issue for" ,
683+ source . email ,
684+ ":" ,
685+ credentialIssue ,
686+ ) ;
687+
666688 if ( credentialIssue ) {
689+ console . log (
690+ "[OAuth] Token EXPIRED for:" ,
691+ source . email ,
692+ "- will attempt refresh" ,
693+ ) ;
667694 options . push ( {
668695 email : source . email ,
669696 available : false ,
0 commit comments