Author |
|
Alex Shloma Newbie
Joined: 22 August 2014
Online Status: Offline Posts: 22
|
Posted: 28 December 2017 at 1:24am | IP Logged
|
|
|
Scenario
My SMTP server receives the following email address in RCPT TO command from Exchange Online:
RCPT TO:<"first.last@domain.com"@domain.com>
When email is processed I send it to another smart host using RelayFromEmlFile (string,string,string) method with "first.last@domain.com"@domain.com string for the 3rd parameter (use value from RCPT TO command).
Issue
Delivery fails with the "Invalid recipient address". I looked at SMTP log of MailBee component and found the following lines, that explain why server rejects recipient:
RCPT TO:<@domain.com>
501 #5.1.1 bad address @domain.com
So, MailBee component parses email address incorrectly.
As a workaround I used combination of RelayFromEmlFile(string, string, EmailAddressCollection) method and EmailAddress(string, null, null) constructor.
But would like to hear what MailBee team has to say about the issue.
Thanks.
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 28 December 2017 at 1:44am | IP Logged
|
|
|
Hi,
Indeed, MailBee.NET doesn't support that complex email addresses (containing other email addresses in local part). It's not rather a bug (when something works not the way it was intended by the author) but a limitation (as it was never intended to handle such specific cases). MailBee treats expressions in quotes as display name. Although in some rare cases (like this one), it's wrong, in majority of cases this helps to avoid inclusion of a display name into an email address.
So, assuming you have a workaround, I would leave it as-is.
Regards,
Alex
|
Back to Top |
|
|
Alex Shloma Newbie
Joined: 22 August 2014
Online Status: Offline Posts: 22
|
Posted: 28 December 2017 at 3:03am | IP Logged
|
|
|
Understand that it is by design.
But the thing is that design is not according to RFC. As a result users get several NDRs a day and actually have no way to reply to emails if list of recipients contain email address of aforementioned format.
According to rfc2822 3.4.1. Addr-spec specification local-part may be a quoted-string. So "first.last@domain.com"@domain.com have valid syntax.
Also, according to 3.4. Address Specification if address contains optional display-name, then addr-spec is enclosed in angle brackets.
So, "first.last@domain.com" must not be interpreted as display-name as there are no addr-spec in angle brackets.
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 28 December 2017 at 3:50am | IP Logged
|
|
|
Yeah, that's right. It would be great if we lived in a perfect world where all mails are composed in strict accordance to RFCs.
In real life, it't not uncommon to get something like "First last" user@domain.com (note that angle brackets are missing), etc.
There is nothing we can do about this. It's just the way it is.
Regards,
Alex
|
Back to Top |
|
|
Alex Shloma Newbie
Joined: 22 August 2014
Online Status: Offline Posts: 22
|
Posted: 02 January 2018 at 2:51am | IP Logged
|
|
|
Hi,
Thanks for the reply.
In my initial post I said that I had found a workaround for scenario when RelayFromEmlFile method is used.
However, I have another part of logic that does NOT use RelayFromEmlFile method. It uses the following methods instead:
- AddJob(string tag, string msgFilename, bool preferXSenderXReceiver, string senderEmail, EmailAddressCollection recipients)
- SeendJobs()
In this scenario the aforementioned workaround does not help:
var recipients = new EmailAddressCollection();
recipients.Add(new EmailAddress("\"first.last@domain\"@domain"), null, null);
mb.AddJob(tag, filePath, false, mailFrom, recipients);
because MailBee component fails to parse domain and throws the following exception: DNS cache states the domain domain"@domain does not exist. It means MailBee component consider everything after the first @ character to be domain.
So, now I have situation when (1) customers are getting angry because they cannot replay to emails with the "local@domain"@domain addresses (they get NDRs, because MailBee cannot handle such addresses); (2) you telling me, that this is not a bug.
Mail systems and smart hosts (like Exchange, IronPort) support quoted strings in local-part!
Unfortunately, I cannot fix this issue for my customers w/o changes in MailBee component (other than searching for another component). So I have to ask you to consider changing either:
- email address parsing algorithm to support quoted strings in local-part;
- or at least update piece of code that gets local and/or domain parts from email address, so that it uses the last @ symbol (not first as it does now).
If you implement 2nd item from the list, I will be able to use workaround with new EmailAddress("\"first.last@domain\"@domain"), null, null) method.
Thanks.
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 02 January 2018 at 5:57am | IP Logged
|
|
|
Hi,
Ok, try this https://afterlogic.com/updates/mailbee_net.zip
It should add support for quoted strings in email addresses and still not break "friendly name" email@address which we encounter from time to time.
Regards,
Alex
|
Back to Top |
|
|
Alex Shloma Newbie
Joined: 22 August 2014
Online Status: Offline Posts: 22
|
Posted: 03 January 2018 at 12:40am | IP Logged
|
|
|
Hi, thanks a lot.
I tested new DLL. Here are my results with the "first.last@domain"@domain address in the list of recipients:
- RelayFromEmlFile(string, string, string). Method works fine.
Entire address with quoted string in local-part is used in RCPT TO command (RCPT TO: <"first.last@domain"@domain>). - AddJob, SendJobs with MX lookup. This scenario still does not work, because domain and local-part are parsed incorrectly for addresses with quoted strings in local-part. You can easily check it by calling EmailAddress.GetDomain and EmailAddress.GetAccountName methods (they return domain"@domain and "first.last, respectively).
Here is part of SMTP log to demonstrate the issue:
New pending job to send e-mail(s). Tag="58", Rows="0".
Processing of pending jobs started.
Processing of a pending job started. Tag="58", Rows="0".
All pending jobs have been put into processing.
Will send mail message.
Will send mail message using MX lookup. Failed recipients not allowed.
Will retrieve MX records for every recipient domain.
Will make DNS query to DNS server at 192.168.0.31 regarding host "domain"@domain".
Creating DNS query about host "domain"@domain".
Sending query to DNS server at "192.168.0.31:53".
Parsing a response that was received from DNS server.
Warning: DNS server replied queried host name was unknown. DnsResponseCode: NameError, HostName DNS server was queried about: "domain"@domain", Base64 encoded response data: AAGBgwABAAAAAAAAEGRvbWFpbjEiQGRvbWFpbjIAAA8AAQ== (trailing zero bytes truncated).
Can you also update GetDomain and GetAccountName methods to support quoted strings. I assume in this case AddJob, SeendJobs methods will be able to deliver to deliver emails using MX lookup.
Thanks.
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 03 January 2018 at 2:52am | IP Logged
|
|
|
Hi,
Ok, next update https://afterlogic.com/updates/mailbee_net.zip
This may affect handling of account@domain@realdomain addresses but, as I said before, it may not be possible to support everything because some patterns contradict with others. For instance, account@domain@realdomain is not RFC-compliant address but it was sometimes used to send email to fax.
Regards,
Alex
|
Back to Top |
|
|
Alex Shloma Newbie
Joined: 22 August 2014
Online Status: Offline Posts: 22
|
Posted: 04 January 2018 at 2:20am | IP Logged
|
|
|
Thanks, initial testing relieved no issues.
Will these changes be included in the next official release? What the scheduler is? Want to include fully QAed component.
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 04 January 2018 at 2:33am | IP Logged
|
|
|
They will be included eventually (in case no other customers start complaining about them). Most likely, in 2018 Q2.
Regards,
Alex
|
Back to Top |
|
|
Alex Shloma Newbie
Joined: 22 August 2014
Online Status: Offline Posts: 22
|
Posted: 13 February 2018 at 2:06am | IP Logged
|
|
|
Hi,
One more question here. I noticed that whenever I request the latest stable version you always share the following link https://afterlogic.com/updates/mailbee_net.zip.
The same with the build that was provided to fix the issue described in this thread. That build was a hotfix w/o full regression testing. You said that code change will be included in 2018 Q2.
So I have questions now:
- Does it mean that I have been always given build, that was not fully QAed?
- Do all official releases of MailBee component go through QA?
- If answer to the previous question is "yes", then how to download the latest official QA-approved build (taking into account that link that I was given before may lead to not official build)?
Thanks.
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 13 February 2018 at 2:20am | IP Logged
|
|
|
Hi,
The latest official QAed build is included in the installation package or published on Nuget (and not marked pre-release).
https://afterlogic.com/updates/mailbee_net.zip is considered beta but QA is still in place. Some things, however, could not be covered by QA (like the change discussed in this thread) so extra feedback from customers needed.
Regards,
Alex
|
Back to Top |
|
|
Alex Shloma Newbie
Joined: 22 August 2014
Online Status: Offline Posts: 22
|
Posted: 13 February 2018 at 3:08am | IP Logged
|
|
|
Thanks.
That was helpful.
So the latest stable build is 11.2.0.590. Can I get complete list of all changes included in 11.2.0.593 (except the one made for me) comparing to 11.2.0.590 so that I can make a decision on whether it is safe to include 11.2.0.593 in my project.
Thanks.
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 13 February 2018 at 5:03am | IP Logged
|
|
|
Other fixes were:
- Entire certificate chain (not just the sender's cert) is now added in the signature when the message is signed with S/MIME
- DKIM signing fix (header list for signing is now populated more correctly)
Regards,
Alex
|
Back to Top |
|
|