1

I'm trying to set up trigger emails through Firebase. I've read other Stackoverflow posts which led me to 1) enable SMTP authentication within my mailbox settings 2) try changing the port to 587 to 465, both of which haven't completely solved the problem for me.

My SMTP Connection URI string is (currently): smtps://{email}@smtp.office365.com:587

When I enable port 587, I get an error in the Firebase Logs and in my Mail status ssl3_get_recrod: wrong version number:

Firebase mail status

Firebase Error Log:

{
  "textPayload": "Error: Error when delivering message=mail/vfKZ9yWVqCYLCg46FGeV: Error: 68429112612736:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:\n\n    at entryFromArgs (/workspace/node_modules/firebase-functions/lib/logger/index.js:130:19)\n    at Object.error (/workspace/node_modules/firebase-functions/lib/logger/index.js:116:11)\n    at Object.deliveryError (/workspace/lib/logs.js:50:33)\n    at deliver (/workspace/lib/index.js:247:14)\n    at processTicksAndRejections (internal/process/task_queues.js:95:5)\n    at async processWrite (/workspace/lib/index.js:372:9)\n    at async /workspace/lib/index.js:384:9",
  "insertId": "641f09ee0009d79eb6c3885d",
  "resource": {
    "type": "cloud_function",
    "labels": {
      "project_id": {projectName},
      "function_name": "ext-firestore-send-email-processQueue",
      "region": "us-central1"
    }
  },
  "timestamp": "2023-03-25T14:49:18.645022Z",
  "severity": "ERROR",
  "labels": {
    "instance_id": "00c61b117c8cf42dc047a1b1d60eb236e452f4ee021b27b8382e81b77bbbca98393f88700863f1d220c139207106596cda24918c509a83aafbab",
    "execution_id": "q8sjsk1of21n"
  },
  "logName": "projects/{projectName}/logs/cloudfunctions.googleapis.com%2Fcloud-functions",
  "trace": "projects/{projectName}/traces/b1849fd9bdc594880a76f221b90bd1a5",
  "receiveTimestamp": "2023-03-25T14:49:18.949736847Z"
}

When I switch to port 465, I get the following status and error logs:

Firestore delivery status

{
  "textPayload": "Error: message=mail/oeS05l1COLA9R7ftTh9X is missing 'delivery' field\n    at entryFromArgs (/workspace/node_modules/firebase-functions/lib/logger/index.js:130:19)\n    at Object.error (/workspace/node_modules/firebase-functions/lib/logger/index.js:116:11)\n    at Object.missingDeliveryField (/workspace/lib/logs.js:54:33)\n    at /workspace/lib/index.js:299:18\n    at processTicksAndRejections (internal/process/task_queues.js:95:5)\n    at async Transaction.runTransaction (/workspace/node_modules/@google-cloud/firestore/build/src/transaction.js:362:26)\n    at async processWrite (/workspace/lib/index.js:281:35)\n    at async /workspace/lib/index.js:384:9",
  "insertId": "641e4ef200040bb705849307",
  "resource": {
    "type": "cloud_function",
    "labels": {
      "region": "us-central1",
      "function_name": "ext-firestore-send-email-processQueue",
      "project_id": {projectName}
    }
  },
  "timestamp": "2023-03-25T01:31:30.265143Z",
  "severity": "ERROR",
  "labels": {
    "execution_id": "kou4acaookby",
    "instance_id": "00c61b117cb72655bc0eaf74dd89e172e987d9d363da50fef7fa612271e2f48b3d4aa10f70bcd7fab115a715cfe71eaecb1776bc7acc1655c35f"
  },
  "logName": "projects/{projectName}/logs/cloudfunctions.googleapis.com%2Fcloud-functions",
  "trace": "projects/{projectName}/traces/16bf16e8b815bdfdaa3ab06555939921",
  "receiveTimestamp": "2023-03-25T01:31:30.447690209Z"
}

I'm not really sure what to try next. Any help is appreciated, thanks.

Pyper
  • 75
  • 1
  • 7
  • 1
    Have you checked with this [issue](https://github.com/firebase/extensions/issues/580#issuecomment-772570889) ? which suggested that using smtp instead of smtps worked for the issue raiser. – Rohit Kharche Mar 26 '23 at 04:59
  • @RohitKharche yes, I have tried that as well, but it didn't work for me. I'll update the question to note that. – Pyper Mar 27 '23 at 00:42
  • If possible can you also share the reproducible steps ? – Rohit Kharche Mar 27 '23 at 12:08
  • @RohitKharche I was mistaken - I had tried using smtp with port 465, but not with port 587. Using smtp with port 587 did indeed work, thanks! If you want to submit that as the answer I'll accept it. Thanks for your help. – Pyper Mar 28 '23 at 02:29
  • Hi posted answer – Rohit Kharche Mar 28 '23 at 08:36

1 Answers1

2

According to this github issue raised you should use smtp instead of smtps with port 587 and this solved the issue. As you can see in the

SMTP settings

SMTP settings of the firebase authentication templates that firebase using smtp.host.com on 587 port.

Although you can also use Trigger Email extension to do this automatically instead of using a separate smtp service.

Rohit Kharche
  • 2,541
  • 1
  • 2
  • 13