0 votes

I want to save draft mail to email account. I have referred this link :
https://www.limilabs.com/qa/1140/save-mail-as-draft

In case of draft(Ex. Gmail draft), it may be any value in "To"(Ex. abc). It may be valid email address or may not be. If pass "abc" builder.From.Add(new MailBox("abc", "Alice")), it throw error of invalid address. If I pass blank, it throw "Can not be empty" error.
How can I solve this problem? Can you please suggest me way to achieve this?

by (3.0k points)
edited by

1 Answer

0 votes
 
Best answer

You should not create MailBox instance using incorrect values - this may lead to serious problems, if you or anyone else, tries to parse a header containing such data later.

You can use MailBox.CreateWithoutValidation static method, if you want to skip validation:

MailBox m = MailBox.CreateWithoutValidation("@", "Name");
by (297k points)
selected by
Yeah.. It's working properly. Thank you.
...