Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • james whittington 19 posts 119 karma points c-trib
    Nov 23, 2021 @ 22:29
    james whittington
    0

    How to use smtp SpecifiedPickupDirectory via appsettings.json

    Hi there,

    I am trying to set up my local environment to use SpecifiedPickupDirectory delivery method on my local install. I've set up the appsettings like so:

     "Smtp": {
      "From": "[email protected]",
      "Host": "localhost",
      "Port": 25,
      "DeliveryMethod": "SpecifiedPickupDirectory",
      "PickupDirectoryLocation": "C:/dev/example/MailDrop"
    }
    

    If i take out the host and port it seems to fallback to the default values (same as here) and then fails to connect.

    Does anyone have this set up and working? I am sure it is just a mismatch in the values I've set.

    The production and staging environments are working fine connecting with sendgrid so its not a major, but I would like to figure it out.

    Thanks!

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    Nov 24, 2021 @ 09:22
    Marc Goodson
    0

    Hi James

    I haven't tried this but... had a nagging feeling there might need to be some depth to the json structure, as in the old money, things like the pickupDirectoryLocation were attributes of the specifiedpickupdirectory element... so 'i think' in json config it might be more like this?

    {
      "mailSettings": {
        "smtp": {
          "deliveryMethod": "SpecifiedPickupDirectory",
          "specifiedPickupDirectory": { 
             "pickupDirectoryLocation": "C:\\folder" 
          }
        }
      }
    }
    

    regards

    Marc

  • Lucas Michaelsen 32 posts 233 karma points
    Nov 24, 2021 @ 17:42
    Lucas Michaelsen
    0

    This how my SMTP configuration for SpecifiedPickupDirectory

        "Smtp": {
          "From": "[email protected]",
          "DeliveryMethod": "SpecifiedPickupDirectory",
          "PickupDirectoryLocation": "C:\temp",
          "Username": "",
          "Password": "",
          "Host": "127.0.0.1"
        }
    
  • james whittington 19 posts 119 karma points c-trib
    Nov 24, 2021 @ 20:53
    james whittington
    0

    Thanks for the tips, Im still getting nowhere with these updated settings.

    It seems like it is still trying to connect using network settings:

    Exception
    
    System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (10061): No connection could be made because the target machine actively refused it. 127.0.0.1:25
       at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
       at MailKit.Net.SocketUtils.ConnectAsync(String host, Int32 port, IPEndPoint localEndPoint, Boolean doAsync, CancellationToken cancellationToken)
       at MailKit.Net.SocketUtils.ConnectAsync(String host, Int32 port, IPEndPoint localEndPoint, Int32 timeout, Boolean doAsync, CancellationToken cancellationToken)
       at MailKit.MailService.ConnectSocket(String host, Int32 port, Boolean doAsync, CancellationToken cancellationToken)
       at MailKit.Net.Smtp.SmtpClient.ConnectAsync(String host, Int32 port, SecureSocketOptions options, Boolean doAsync, CancellationToken cancellationToken)
       at Umbraco.Cms.Infrastructure.Mail.EmailSender.SendAsyncInternal(EmailMessage message, String emailType, Boolean enableNotification)
       at Umbraco.Cms.Infrastructure.Mail.EmailSender.SendAsync(EmailMessage message, String emailType)
    

    Is this expected when using pickup directory?

  • Lucas Michaelsen 32 posts 233 karma points
    Nov 25, 2021 @ 21:15
    Lucas Michaelsen
    0

    To help even more I need some more details. Where have you located the SMTP configuration at appsettings.json

    So is the Smtp config at the root of the root of the json or neasted in some other object?

    My Appsettings is like this:

    {
      "$schema": "./umbraco/config/appsettings-schema.json",
      "ConnectionStrings": {
        "umbracoDbDSN": "database"
      },
      "Serilog": {
        "MinimumLevel": {
          "Default": "Information",
          "Override": {
            "Microsoft": "Warning",
            "Microsoft.Hosting.Lifetime": "Information",
            "System": "Warning"
          }
        }
      },
      "Umbraco": {
        "CMS": {
          "Content": {
            "Notifications": {
              "Email": "[email protected]"
            },
            "MacroErrors": "Throw"
          },
          "Global": {
            "DefaultUILanguage": "en-us",
            "HideTopLevelNodeFromPath": true,
            "UmbracoPath": "~/umbraco",
            "TimeOutInMinutes": 20,
            "UseHttps": false,
            "Id": "81e5682b-3a48-494d-8e37-e8dc6a7bfa4b",
            "Smtp": {
              "From": "[email protected]",
              "DeliveryMethod": "SpecifiedPickupDirectory",
              "PickupDirectoryLocation": "C:\temp",
              "Username": "",
              "Password": "",
              "Host": "127.0.0.1"
            }
          },
          "Hosting": {
            "Debug": false
          },
          "KeepAlive": {
            "DisableKeepAliveTask": false,
            "KeepAlivePingUrl": "{umbracoApplicationUrl}/api/keepalive/ping"
          },
          "RequestHandler": {
            "ConvertUrlsToAscii": "try"
          },
          "RuntimeMinification": {
            "dataFolder": "umbraco/Data/TEMP/Smidge",
            "version": "637694912170665642"
          },
          "Security": {
            "KeepUserLoggedIn": false,
            "UsernameIsEmail": true,
            "AllowPasswordReset": true,
            "HideDisabledUsersInBackoffice": false,
            "AllowedUserNameCharacters": "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._@+\\",
            "UserPassword": {
              "RequiredLength": 10,
              "RequireNonLetterOrDigit": false,
              "RequireDigit": false,
              "RequireLowercase": false,
              "RequireUppercase": false,
              "MaxFailedAccessAttemptsBeforeLockout": 5
            },
            "MemberPassword": {
              "RequiredLength": 10,
              "RequireNonLetterOrDigit": false,
              "RequireDigit": false,
              "RequireLowercase": false,
              "RequireUppercase": false,
              "MaxFailedAccessAttemptsBeforeLockout": 5
            }
          },
          "Tours": {
            "EnableTours": true
          },
          "ModelsBuilder": {
            "ModelsMode": "InMemoryAuto",
            "Enable": true
          }
        }
      }
    }
    

    And a look down i the Source of Umrabco the first thing the do in SendAsyncInternal is chech if the PickupDirectoryLocation isnullorwhitespace

    So my best guess is the SMTP config is place at wrong place.

    The default settings in the appsetting is a SMTP config is not provied is Nework

  • james whittington 19 posts 119 karma points c-trib
    Nov 25, 2021 @ 22:56
    james whittington
    0

    Thanks for keeping on coming back on this, its really appreciated.

    Here is the config I am using (database and guid id values replaced with fake data.)

    {
      "$schema": "./umbraco/config/appsettings-schema.json",
      "Serilog": {
        "MinimumLevel": {
          "Default": "Information",
          "Override": {
            "Microsoft": "Warning",
            "Microsoft.Hosting.Lifetime": "Information",
            "System": "Warning"
          }
        }
      },
      "ConnectionStrings": {
        "umbracoDbDSN": "db"
      },
      "Umbraco": {
        "CMS": {
          "Hosting": {
            "Debug": false
          },
          "Global": {
            "Id": "{guid}",
            "Smtp": {
              "From": "[email protected]",
              "DeliveryMethod": "SpecifiedPickupDirectory",
              "PickupDirectoryLocation": "C:\\dev\\test",
              "Username": "",
              "Password": "",
              "Host": "127.0.0.1"
            }
          },
          "ModelsBuilder": {
            "Enable": true,
            "ModelsMode": "SourceCodeManual"
          },
    
          "RichTextEditor": {
            "Commands": [
              {
                "Alias": "blockquote",
                "Name": "Blockquote",
                "Mode": "Selection"
              }
            ]
          },
          "Content": {
            "Error404Collection": [
              {
                "Culture": "default",
                "ContentXPath": "//page404"
              }
            ]
          }
        }
      },
        "uSync": {
          "Settings": { 
            "ImportAtStartup": "Settings", 
            "ExportOnSave": "Settings",
            "UiEnabledGroups": "Settings"
          }       
        }
      }
    

    I need to escape the back slashes in my path or I get a runtime error about unescaped values.

    I am hosting with IIS Express, if that makes a difference?

  • Lucas Michaelsen 32 posts 233 karma points
    Nov 27, 2021 @ 19:41
    Lucas Michaelsen
    0

    Hello James,

    No the IIS Expree should not make any differ. Hmm only think I can see is if PickupDirectoryLocationis is not configued or Umbraco not can finde the PickupDirectoryLocation path on the local machine, it will fallback to host.

    Do you have the path C:\dev\test created on your machine? Else to it out, and make the folders.

  • james whittington 19 posts 119 karma points c-trib
    Nov 30, 2021 @ 03:13
    james whittington
    0

    Sorry about the no contact I got extremely busy and this took a back seat, really appreciate all the help here though.

    I'm pretty sure that I have everything set up correctly, and the site is using send grid in production without any issues, so the config section is in the right place.

    The post below says it is a bug, my next step will be to play around with sourcelink and see whats going on internally.

  • andrew shearer 510 posts 659 karma points
    Nov 30, 2021 @ 01:56
    andrew shearer
    0

    hi everyone, this is a bug. pls up vote https://github.com/umbraco/Umbraco-CMS/pull/11548 and hopefully it can get pulled into 9.1.2 or 9.2

    thanks

Please Sign in or register to post replies

Write your reply to:

Draft