Smtp localhost not working

Hello,

May I ask you for help? :slight_smile:

I have problem with local smtp server (postfix). I tested local smtp sever from telnet, all looks like fine.

But when I try verification email from web GUI bitwarden, then I get error below:

2020-03-24 16:42:31.274 +00:00 [Error] Cannot assign requested address
System.Net.Sockets.SocketException (99): Cannot assign requested address
at System.Net.Sockets.Socket.BeginConnectEx(EndPoint remoteEP, Boolean flowContext, AsyncCallback callback, Object state)
at System.Net.Sockets.Socket.UnsafeBeginConnect(EndPoint remoteEP, AsyncCallback callback, Object state, Boolean flowContext)
at System.Net.Sockets.Socket.BeginConnect(EndPoint remoteEP, AsyncCallback callback, Object state)
at System.Net.Sockets.Socket.BeginConnect(IPAddress address, Int32 port, AsyncCallback requestCallback, Object state)
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 Bit.Core.Services.MailKitSmtpMailDeliveryService.SendEmailAsync(MailMessage message) in /home/appveyor/projects/server/src/Core/Services/Implementations/MailKitSmtpMailDeliveryService.cs:line 84
at Bit.Core.Services.HandlebarsMailService.SendVerifyEmailEmailAsync(String email, Guid userId, String token) in /home/appveyor/projects/server/src/Core/Services/Implementations/HandlebarsMailService.cs:line 47
at Bit.Core.Services.UserService.SendEmailVerificationAsync(User user) in /home/appveyor/projects/server/src/Core/Services/Implementations/UserService.cs:line 476
at Bit.Api.Controllers.AccountsController.PostVerifyEmail() in /home/appveyor/projects/server/src/Api/Controllers/AccountsController.cs:line 146
at lambda_method(Closure , Object )
at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

my config:

[email protected]
globalSettings__mail__smtp__host=localhost
globalSettings__mail__smtp__port=587
globalSettings__mail__smtp__ssl=false
globalSettings__mail__smtp__username=REPLACE
globalSettings__mail__smtp__password=REPLACE
globalSettings__mail__smtp__trustServer=true

version API
Object":“version”,“Version”:“1.33.0”}

In web gui is error:
An error has occurred.
An unhandled server error has occurred.

Thank you & best regards.
Masin.

I’m apologize. It was trivial problem. Solution was change localhost (globalSettings__mail__smtp__host=localhost) to my LAN IP address. :slight_smile:

1 Like