Class com.aspose.email.system.exceptions.FormatException: The specified string is not in the form required for an e-mail address


#1

Hi,
Exception when I’m trying to create MailAddress with address of format :
/O=EXCHANGE HOSTING/OU=EXCHANGE ADMINISTRATIVE GROUP (FYDIBOHF23SPDLT)/CN=RECIPIENTS/CN=JKUTSTORY_CSAI

MailAddress tmp = new MailAddress("/O=EXCHANGE HOSTING/OU=EXCHANGE ADMINISTRATIVE GROUP (FYDIBOHF23SPDLT)/CN=RECIPIENTS/CN=JKUTSTORY_CSAI");

But actually this is something that should be accepted , as this is arrived from the Office 365 Exchange. I think this was fixed in the past (few years ago) and now we see it again.
Please advise.
Thanks


#2

@slavago,

I have observed the issue shared by you and request you to please first try using latest Aspose.Email for Java 19.9 on your end. In case the issue still persist then please share the working sample code along with test account details reproducing the issue on your end so that we may proceed further with investigation on our end.


#3

Did you read my message?
This line is the working sample with all needed information to reproduce the problem :

MailAddress tmp = new MailAddress("/O=EXCHANGE HOSTING/OU=EXCHANGE ADMINISTRATIVE GROUP (FYDIBOHF23SPDLT)/CN=RECIPIENTS/CN=JKUTSTORY_CSAI");

So, please run it on your end.
Thanks


#4

@slavago,

I have tested the sample code line for adding MailAddress shared by you. The exception that is thrown is wrong email format exception. Are you sure if you are adding email w.r.t correct email format in constructor argument.


#5

Yes, this is correct email address returned by Exchange, office 365 (corporate). And this was working in the past, few years ago, if I remember correctly, you guys fixed same issue. But , anyway this ia valid responded email from Exchange.
Please fix this as it broken or provide any other way set email address within corporate Exchange.
Thanks


#6

@slavago,

Thank you for your feedback. An issue with ID EMAILJAVA-34601 has been added in our issue tracking system to investigate the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.


#7

Thanks, I appreciate that


#8

@slavago,

Your are very welcome.


#9

I am experiencing the same problem (with .NET version). Office 365 sometimes generates MSG with non-standard email address, which causes:

new Aspose.Email.MailAddress(String address, String displayName)

to throw “The specified string is not in the form required for an e-mail address” exception. I think Aspose is attempting to validate the provided address according to ‘standard’ email address rules. But Office 365 seems to use its own non-standard sometimes.

I think best & simple solution would be option to disable email address validation in Aspose.Email.MailAddress class, if user does not need/want it.

Thanks


#10

@ast3,

Can you please share source file along with sample project to reproduce issue so that we may help you out.


#11

Hi Adnan,

The problem is that Office 365 sometimes generate MSGs that have non-standard email addresses, which causes instantiation of new Aspose.Email.MailAddress(String address, String displayName) to throw exception. Specifically, it sometimes adding an extra “.” after SMTP address.

You can reproduce result by creating MailAddress with any email address ending with “.”, such as:

var address = new Aspose.Email.MailAddress("x@x.com.", "display name");

A good & simple solution would be to have option to disable email validation.


#12

@ast3,

I have observed your requirements and suggestion. An issue with ID EMAILNET-39638 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.