Code Monkey home page Code Monkey logo

smtpserver's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

smtpserver's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

nuget
Rnwood.SmtpServer.Tests/Rnwood.SmtpServer.Tests.csproj
  • Xunit.SkippableFact 1.4.13
  • MailKit 2.5.2
  • Moq 4.20.70
  • xunit 2.7.0
  • System.Net.Security 4.3.2
  • System.Collections.NonGeneric 4.3.0
  • xunit.runner.visualstudio 2.5.7
  • NETStandard.Library 2.0.3
  • Microsoft.NET.Test.Sdk 17.9.0
  • FluentAssertions 6.12.0
Rnwood.SmtpServer/Rnwood.SmtpServer.csproj
  • System.Net.Security 4.3.2
  • System.Collections.NonGeneric 4.3.0
  • Microsoft.Extensions.Logging.Abstractions 3.1.32
  • Microsoft.Extensions.Logging 2.2.0
  • Microsoft.CodeAnalysis.CSharp 4.9.2

  • Check this box to trigger a request for Renovate to run again on this repository

Invalid list of available AUTH methods.

Hello,
I have problems with Authorization (I'm using MailKit as client). I get the following exception:
System.NotSupportedException: 'No compatible authentication mechanisms found.'
By looking at source code I see in Rnwood.SmtpServer\Extensions\Auth\AuthExtensionProcessor.cs:GetEHLOKeywords() that list of available auth methods is created by joining full names of IAuthMechanism classes, not a IAuthMechanism.Identifier. It should be something simmilar to:
string mids = string.Join(" ", mechanisms.Select( am => am.Identifier ).ToArray() );

I'm using latest prerelease nuget (3.1.0-ci0466).

Just send 8 bit messages get incorrectly converted to UTF-8

If client sends an 8 bit message without using 8BITIME (which implies UTF-8) then the encoding is changed into UTF8 in the received message bytes.

Repro:

using System.Net.Mail;
using System.Net.Mime;
using System.Text;

var smtpClient = new SmtpClient("localhost")
            {
                Port = 25,
            };

            var mailMessage = new MailMessage
            {
                From = new MailAddress("[email protected]"),
                Subject = "Latin test",
                //BodyTransferEncoding = TransferEncoding.,
                Body =
                    "<span>Homines in indicaverunt nam purus quáestionem sentiri unum. Afflueret contentus diam errore faciam, honoris mucius omnem pélléntésqué reiciendis. Acuti admissum arbitrantur concederetur dediti, ferrentur fugiendus inferiorem peccant ponti quando solam ullius. áb atilii concursio constituamus, définitioném diligenter graeci illam máius operis opinionum pótióne versatur. Alliciat aspernari consoletur disserunt, impendere interiret reliquarum verum. Convállis essent foedus gravida iustioribus, mox notissima perpaulum praeclare probatum, prohiberet sensibus. Condimentum efficeretur iis insipientiam, inutile logikh ne ornare, paulo primis primo pugnare putarent quiddam reperiuntur. \r\nCéramico cónsistat éiusdém licet offendimur, recusandae referendá. Cupiditatés hónesta musicis possent, respondendum sollicitudines. Breviter democrito dolor electram illa, ludicra non occulta pérféréndis principio servare suum tranquillitatem. Consentinis probatus qualisque tollatur veritatis. In inséquitur ortum pertinaces, sentit stoici sum téréntii.</span>",
                BodyEncoding = Encoding.Latin1,
                BodyTransferEncoding = TransferEncoding.EightBit,
                IsBodyHtml = true,
            };
            mailMessage.To.Add("[email protected]");

            smtpClient.Send(mailMessage);

Race condition in dispose

We're facing a (rare) race condition in Rnwood.SmtpServer.SmtpServer.KillConnections:

System.InvalidOperationException : Collection was modified; enumeration operation may not execute.
   at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
at System.Linq.Enumerable.CastIterator[TResult](IEnumerable source)+MoveNext()
at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
at Rnwood.SmtpServer.SmtpServer.KillConnections()
at Rnwood.SmtpServer.SmtpServer.Stop(Boolean killConnections)
at Rnwood.SmtpServer.SmtpServer.Stop()
at Rnwood.SmtpServer.SmtpServer.Dispose(Boolean disposing)
at Rnwood.SmtpServer.SmtpServer.Dispose()
at Octopus.IntegrationTests.Core.EmailSending.SmtpClientWrapperFixture.WhenSendingAnEmailToAServerWithNoTls_TheEmailShouldBeAccepted() in /opt/buildagent/work/abb2fbfce959a439/source/Octopus.IntegrationTests/Core/EmailSending/SmtpClientWrapperFixture.cs:line 44
at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.BlockUntilCompleted()
at NUnit.Framework.Internal.MessagePumpStrategy.NoMessagePumpStrategy.WaitForCompletion(AwaitAdapter awaitable)
at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()
------- Stdout: -------
11/30/2020 9:33:24 PM 34 Trace Connected to SMTP server smtp://localhost:37175/?starttls=when-available
11/30/2020 9:33:24 PM 34 Trace SMTP received: 220 ip-10-10-11-232 smtp4dev ready
11/30/2020 9:33:24 PM 34 Trace SMTP sent: EHLO [127.0.0.1]
11/30/2020 9:33:24 PM 34 Trace SMTP received: 250-Nice to meet you.
250-8BITMIME
250-SIZE
250 SMTPUTF8
11/30/2020 9:33:24 PM 28 Trace SMTP sent: MAIL FROM:<[email protected]>
11/30/2020 9:33:24 PM 28 Trace SMTP received: 250 New message started
11/30/2020 9:33:24 PM 32 Trace SMTP sent: RCPT TO:<[email protected]>
11/30/2020 9:33:24 PM 31 Trace SMTP received: 250 Recipient accepted
11/30/2020 9:33:24 PM 32 Trace SMTP sent: DATA
11/30/2020 9:33:24 PM 32 Trace SMTP received: 354 End message with period
11/30/2020 9:33:24 PM 32 Trace SMTP sent: From: [email protected]
To: [email protected]
Subject: Test subject
Date: Mon, 30 Nov 2020 21:33:24 +1000
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
11/30/2020 9:33:24 PM 32 Trace SMTP sent:
Test body
11/30/2020 9:33:24 PM 28 Trace SMTP sent:
.
11/30/2020 9:33:24 PM 12 Trace SMTP received: 250 Mail accepted
11/30/2020 9:33:24 PM 34 Trace SMTP sent: QUIT
11/30/2020 9:33:24 PM 12 Trace SMTP received: 221 Goodbye

This is pretty rare:
image
image
(first one is testing async, second is testing sync)

Let me know if you want to see the tests/code in question - I dont think it's too important here.

Looking into the code, i think this line is causing the error. Even though activeConnections is a synchronized list, it's not threadsafe for enumeration. Looking at the docs, it seems the code needs to lock on the SyncRoot property before enumeration:

lock(myCollection.SyncRoot)
{
    foreach (object item in myCollection)
    {
        // Insert your code here.
    }
}

Would you be willing to accept a PR that changes this?

The same code does work on Windows but not on Linux

I developed a small SMTP-Server which is used to receive mails sent by my China-built cameras for wild watching. They sent two kinds of mails and I wrote an dotnet application which works on my windows server without any problem.
Because I want to have the windows server as a development server reachable also from my Mac I have deployed the complete solution to a standard Ubuntu 20.x powered V-Server.
The camera is working as expected, as when I will send the mail to the Windows server but much slower. But it states that the mail was sent without any errors.
But on the console I see only that the start and end events are fired. The Auth-Event and also the main receive-Event ist not fired.

I can provide you access to my git or even sent mails to a server on which you can try to receive the message.

Hello

Hello,

Do you have any contact info? just want to ask you some questions, if that's possible.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.