Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullReferenceException during Auto-Relay #1438

Closed
sodermatt opened this issue Apr 26, 2024 · 4 comments
Closed

NullReferenceException during Auto-Relay #1438

sodermatt opened this issue Apr 26, 2024 · 4 comments

Comments

@sodermatt
Copy link

sodermatt commented Apr 26, 2024

I'm trying to get the Auto-Relay-Feature running.

I configured the following RelayOptions (Mail-Addresses, Server-Name are replaced with dummy-values)

`"RelayOptions": {

"IsEnabled": true,
"SmtpServer": "mail.domain.de",
"SmtpPort": 25,
"TlsMode": "Auto",
"AutomaticEmails": ["xyz@domain.de"],
"AutomaticRelayExpression": "recipient.match(/xyz@domain.de$/)",
"SenderAddress": "",
"Login": "",
"Password": ""
},`

When I submit a "Send-MailMessage"-PS, the mail is successfully delivered to smtp4dev, but the Auto-Relay throws an error.

Output in cmd-Window:

Session started. Client address ::1. Message received. Client address ::1, From abc@domain.de, To xyz@domain.de, SecureConnection: False. Processing received message AutomaticRelayExpression: (message: {message.Id}, recipient: 23cdcf12-29df-4f89-bc4e-700694f50291, session: {session.Id}) => xyz@domain.de => 04de849a-bf01-4745-81ca-660f90e887cd Relaying message to xyz@domain.de Can not relay message to xyz@domain.de: System.NullReferenceException: Object reference not set to an instance of an object. at Rnwood.Smtp4dev.Server.Smtp4devServer.TryRelayMessage(Message message, MailboxAddress[] overrideRecipients) in D:\a\1\s\Rnwood.Smtp4dev\Server\Smtp4devServer.cs:line 407 System.NullReferenceException: Object reference not set to an instance of an object. at Rnwood.Smtp4dev.Server.Smtp4devServer.TryRelayMessage(Message message, MailboxAddress[] overrideRecipients) in D:\a\1\s\Rnwood.Smtp4dev\Server\Smtp4devServer.cs:line 407 Processing received message DONE Session completed. Client address ::1. Number of messages 1.

Am I missing a Config-Option?

@rnwood
Copy link
Owner

rnwood commented Apr 26, 2024 via email

@rnwood
Copy link
Owner

rnwood commented Apr 27, 2024

You can ignore that question. I am able to reproduce and will resolve this.

The ID is because there is a bug in the logging. It's the message ID.

@rnwood
Copy link
Owner

rnwood commented Apr 27, 2024

Should be resolved by the PR.

Note that AutomaticEmails and the result of AutomaticRelayExpression will both apply are combined and the message is relayed to the distinct results for each origiinal recpient. So you don't need to configure both to match the same addresses. I guess you already know this and you're just testing?

@sodermatt
Copy link
Author

So you don't need to configure both to match the same addresses. I guess you already know this and you're just testing?

Correct, this was just a test configuration - thanks for reacting this fast, really appreciated! Will test as soon as build is done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants