FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    SMTP integration works with default tenant, but not duplicated one

    Scheduled Pinned Locked Moved Solved
    Q&A
    2
    11
    1.8k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      mculley
      last edited by

      I successfully integrated SendGrid into my default tenant. I then duplicated the tenant and tested email and it fails. I created a new API key with SendGrid and it still fails.

      Unable to send email via JavaMail
      Prime Messaging Exception
      

      I am confused by the last part of the event log msg:

      message successfully delivered to mail server
      

      Here is the event log msg.

      Email debug information
      
      7/21/2023 10:32:29 PM Z DEBUG: getProvider() returning jakarta.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]
      DEBUG SMTP: need username and password for authentication
      DEBUG SMTP: protocolConnect returning false, host=smtp.sendgrid.net, user=apikey, password=<null>
      DEBUG SMTP: useEhlo true, useAuth true
      DEBUG SMTP: trying to connect to host "smtp.sendgrid.net", port 587, isSSL false
      220 SG ESMTP service ready at geopod-ismtpd-1
      DEBUG SMTP: connected to host "smtp.sendgrid.net", port: 587
      EHLO hiddenlayer-1.instance.fusionauth.io
      250-smtp.sendgrid.net
      250-8BITMIME
      250-PIPELINING
      250-SIZE 31457280
      250-STARTTLS
      250-AUTH PLAIN LOGIN
      250 AUTH=PLAIN LOGIN
      DEBUG SMTP: Found extension "8BITMIME", arg ""
      DEBUG SMTP: Found extension "PIPELINING", arg ""
      DEBUG SMTP: Found extension "SIZE", arg "31457280"
      DEBUG SMTP: Found extension "STARTTLS", arg ""
      DEBUG SMTP: Found extension "AUTH", arg "PLAIN LOGIN"
      DEBUG SMTP: Found extension "AUTH=PLAIN", arg "LOGIN"
      STARTTLS
      220 Begin TLS negotiation now
      EHLO hiddenlayer-1.instance.fusionauth.io
      250-smtp.sendgrid.net
      250-8BITMIME
      250-PIPELINING
      250-SIZE 31457280
      250-STARTTLS
      250-AUTH PLAIN LOGIN
      250 AUTH=PLAIN LOGIN
      DEBUG SMTP: Found extension "8BITMIME", arg ""
      DEBUG SMTP: Found extension "PIPELINING", arg ""
      DEBUG SMTP: Found extension "SIZE", arg "31457280"
      DEBUG SMTP: Found extension "STARTTLS", arg ""
      DEBUG SMTP: Found extension "AUTH", arg "PLAIN LOGIN"
      DEBUG SMTP: Found extension "AUTH=PLAIN", arg "LOGIN"
      DEBUG SMTP: protocolConnect login, host=smtp.sendgrid.net, user=apikey, password=<non-null>
      DEBUG SMTP: Attempt to authenticate using mechanisms: LOGIN PLAIN DIGEST-MD5 NTLM XOAUTH2 
      DEBUG SMTP: Using mechanism LOGIN
      DEBUG SMTP: AUTH LOGIN command trace suppressed
      DEBUG SMTP: AUTH LOGIN succeeded
      DEBUG SMTP: use8bit false
      MAIL FROM:<support@hiddenlayer.com>
      250 Sender address accepted
      RCPT TO:<mculley@hiddenlayer.com>
      250 Recipient address accepted
      DEBUG SMTP: Verified Addresses
      DEBUG SMTP:   mculley@hiddenlayer.com
      DATA
      354 Continue
      Date: Fri, 21 Jul 2023 22:32:28 +0000 (UTC)
      From: support@hiddenlayer.com
      Reply-To: support@hiddenlayer.com
      To: mculley@hiddenlayer.com
      Message-ID: <1132593178.71.1689978748428@hiddenlayer-1.instance.fusionauth.io>
      Subject: FusionAuth SMTP Test
      MIME-Version: 1.0
      Content-Type: multipart/alternative; 
      	boundary="----=_Part_70_1022356550.1689978748428"
      
      ------=_Part_70_1022356550.1689978748428
      Content-Type: text/plain; charset=UTF-8
      Content-Transfer-Encoding: 7bit
      
      Congratulations! You have successfully configured the SMTP server.
      
      Tenant Id: 6528d22f-2bc0-dd01-7cd5-bf80935474a3
      Tenant name: stage
      
      Host: smtp.sendgrid.net
      Port: 587
      Username: apikey
      Security: TLS
      
      
      - FusionAuth
      ------=_Part_70_1022356550.1689978748428
      Content-Type: text/html; charset=UTF-8
      Content-Transfer-Encoding: 7bit
      
      <p>
      Congratulations! You have successfully configured the SMTP server.
      </p>
      
      <table style="margin-bottom: 10px;">
        <tr>
          <td><strong>Tenant Id:</strong></td>
          <td>6528d22f-2bc0-dd01-7cd5-bf80935474a3</td>
        </tr>
        <tr>
          <td><strong>Tenant name:</strong></td>
          <td>stage</td>
        </tr>
      </table>
      
      <table style="margin-bottom: 10px;">
        <tr>
          <td><strong>Host:</strong></td>
          <td>smtp.sendgrid.net</td>
        </tr>
        <tr>
          <td><strong>Port:</strong></td>
          <td>587</td>
        </tr>
        <tr>
          <td><strong>Username:</strong></td>
          <td>apikey</td>
        </tr>
        <tr>
          <td><strong>Security:</strong></td>
          <td>TLS</td>
        </tr>
      </table>
      
      
      <p>
      - FusionAuth
      </p>
      
      ------=_Part_70_1022356550.1689978748428--
      .
      250 Ok: queued as EoKj0DJlSLOG1mgulDMzmg
      DEBUG SMTP: message successfully delivered to mail server
      QUIT
      221 See you later
      
      1 Reply Last reply Reply Quote 1
      • M
        mculley @mark.robustelli
        last edited by

        @mark-robustelli

        I tried reconfiguring this again and was successful. I do not know if It was user error the first three times and not the fourth or if I changed the configuration somehow that resulted in the desired behavior.

        mark.robustelliM 1 Reply Last reply Reply Quote 0
        • mark.robustelliM
          mark.robustelli
          last edited by

          Did you check the SMTP settings in the duplicated tenant? The password does not copy when it is duplicated.

          https://fusionauth.io/docs/v1/tech/core-concepts/tenants#overview

          "When using the duplicate feature for Tenants, the SMTP password is not copied. You will have to enter this manually before sending emails.

          M 1 Reply Last reply Reply Quote 0
          • M
            mculley @mark.robustelli
            last edited by

            @mark-robustelli

            yes. The SendGrid API key is the password

            mark.robustelliM 1 Reply Last reply Reply Quote 0
            • mark.robustelliM
              mark.robustelli @mculley
              last edited by

              @mculley When you go edit the copied tenants settings and send a test email. Does that work for you?

              Screenshot 2023-07-28 at 8.59.06 AM.png

              The response should look something like this:
              Screenshot 2023-07-28 at 9.00.31 AM.png

              If that works, I would check the SendGrid activity for failure (it may take a while to show up in the activity)Screenshot 2023-07-28 at 9.03.26 AM.png :

              I'm thinking Sendgrid may be blocking it for some reason if FusionAuth thinks the send worked.

              M 3 Replies Last reply Reply Quote 0
              • M
                mculley @mark.robustelli
                last edited by

                @mark-robustelli

                No, it does not. That is my original description of the problem.

                • I created a stage tenant and configured SMTP for SendGrid.
                • Email test was successful.
                • I created a tenant named prod.
                • The SMTP configuration was auto-added to the prod tenant
                • prod send test email failed.
                • I then went through each prod SMTP field one by one and made sure it was correct. I even generated a new API key.
                • prod send test email again failed.
                1 Reply Last reply Reply Quote 0
                • M
                  mculley @mark.robustelli
                  last edited by

                  @mark-robustelli

                  I am having other trouble that makes me wonder if there is some configuration in the tenant that I am not understanding or is not correct. Specifically, I am using Postman to send in a request to the /api/entity/search endpoint. Works for the stage tenant but I cannot get the same request to work when I change X-FusionAuth-TenantId to the id of prod tenant.

                  To summarize, for the prod tenant, neither of these two things work:

                  • Send Test Email
                  • /api/entity/search
                  1 Reply Last reply Reply Quote 0
                  • M
                    mculley @mark.robustelli
                    last edited by

                    @mark-robustelli

                    PS: The /api/entity/search request fails with Http Code 401

                    mark.robustelliM 1 Reply Last reply Reply Quote 0
                    • mark.robustelliM
                      mark.robustelli @mculley
                      last edited by mark.robustelli

                      @mculley Thanks for the info. I took a look and it appears you have access to the Account Portal. If this is a time sensitive issue you can receive more timely support by opening a ticket since you have a support contract with FusionAuth.

                      In the mean-time, was not able to re-create your SMTP issue and appeared to work on my end. I will also spin your question about the entity serach onto another topic and take a look at if over the next couple of days. You can find the question here: Problem with entity search after copying Tenant.

                      M 1 Reply Last reply Reply Quote 0
                      • M
                        mculley @mark.robustelli
                        last edited by

                        @mark-robustelli

                        I tried reconfiguring this again and was successful. I do not know if It was user error the first three times and not the fourth or if I changed the configuration somehow that resulted in the desired behavior.

                        mark.robustelliM 1 Reply Last reply Reply Quote 0
                        • mark.robustelliM
                          mark.robustelli @mculley
                          last edited by

                          @mculley , in any case, I am glad it is working for you. I think the important take away here is that if this happens again or something else comes up and you need timely support, you have access to the Account Portal.

                          Of course we are always glad to see you here in the forum as well.

                          M 1 Reply Last reply Reply Quote 0
                          • M mculley has marked this topic as solved on
                          • M
                            mculley @mark.robustelli
                            last edited by

                            @mark-robustelli

                            right on. I will use that next time.

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post