Setup a self hosted instance and am using Gmail SMTP server with an app password. However, when I try to register a test user, I get an error indicating that “This server hasn’t correctly set up email.”

I used the Lemmy Easy Deploy project to set my system up. Following is the relevant section of the lemmy.hjson config file:

  email: {
    smtp_server: "smtp.gmail.com:587"
    smtp_login: "<user_name>@gmail.com"
    smtp_password: "my_super_secret_password"
    smtp_from_address: " <[email protected]>"
    tls_type: "tls"
  }

How can I find out why my Lemmy server thinks the email isn’t setup properly?

How can I send email from my instance using a Gmail account I created for this purpose?

  • @HanSoolooOP
    link
    11 year ago

    A bit more progress as I am able to get connected to Gmail SMTP server via the openssl command inside the Lemmy container. Still wondering why I get the “This server hasn’t correctly set up email” error.

    lemmy@2ba1e7b7ab5b:/$ openssl s_client -connect smtp.gmail.com:587 -starttls smtp
    CONNECTED(00000003)
    depth=2 C = US, O = Google Trust Services LLC, CN = GTS Root R1
    verify return:1
    depth=1 C = US, O = Google Trust Services LLC, CN = GTS CA 1C3
    verify return:1
    depth=0 CN = smtp.gmail.com
    verify return:1
    ---
    Certificate chain
     0 s:CN = smtp.gmail.com
       i:C = US, O = Google Trust Services LLC, CN = GTS CA 1C3
     1 s:C = US, O = Google Trust Services LLC, CN = GTS CA 1C3
       i:C = US, O = Google Trust Services LLC, CN = GTS Root R1
     2 s:C = US, O = Google Trust Services LLC, CN = GTS Root R1
       i:C = BE, O = GlobalSign nv-sa, OU = Root CA, CN = GlobalSign Root CA
    ---
    Server certificate
    -----BEGIN CERTIFICATE-----
    MIIEhjCCA26gAwIBAgIQGpg14/yC+QkSeUGoITtsEjANBgkqhkiG9w0BAQsFADBG
    MQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExM
    QzETMBEGA1UEAxMKR1RTIENBIDFDMzAeFw0yMzA2MTkwODIwNDZaFw0yMzA5MTEw
    ODIwNDVaMBkxFzAVBgNVBAMTDnNtdHAuZ21haWwuY29tMFkwEwYHKoZIzj0CAQYI
    KoZIzj0DAQcDQgA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ZG0WvtxVdF1YUqshBIeiBTLxOQaMwOvyXXBkxV92
    98Caewi/Ra72HBN63nXGblcLqYQYRu9CXJ2bBf+qxxsoUe/gqd/F52x/q4EtUW3X
    2YF3CsUmXMUqmVw5+GnIx9veSPXTMyrEi4//DHKsQZ99o1hL7DSF9hwMX0vRUMaY
    zrB1N+lxzdf/WdgV1Sl1XOjMYsWYYjgJRjYXleCtUlSBvyU5SR/svev+RKheAOyn
    SLct8QvloYXRiQ==
    -----END CERTIFICATE-----
    subject=CN = smtp.gmail.com
    
    issuer=C = US, O = Google Trust Services LLC, CN = GTS CA 1C3
    
    ---
    No client certificate CA names sent
    Peer signing digest: SHA256
    Peer signature type: ECDSA
    Server Temp Key: X25519, 253 bits
    ---
    SSL handshake has read 4579 bytes and written 419 bytes
    Verification: OK
    ---
    New, TLSv1.3, Cipher is TLS_AES_256_GCM_SHA384
    Server public key is 256 bit
    Secure Renegotiation IS NOT supported
    Compression: NONE
    Expansion: NONE
    No ALPN negotiated
    Early data was not sent
    Verify return code: 0 (ok)
    ---
    250 SMTPUTF8
    
  • @HanSoolooOP
    link
    11 year ago

    Looks like we have this issue: https://github.com/LemmyNet/lemmy/issues/3058

    Network configs were removed from the docker-compose file. Does anyone know whether in its current form, whether any outgoing network connection on TCP/587 (TLS SMTP) would work?

    Can’t test myself inside the Lemmy container, as that one doesn’t have any real commands installed in it.