-
Notifications
You must be signed in to change notification settings - Fork 41
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
Solving conversion of mails with Swiftmailer #24
Conversation
I ... don't like this. You're swallowing all errors, expected or otherwise. I think the idea, overall, is reasonable -- MAPI to Mime is an imperfect translation and so the implementer can expect that some fidelity is lost. But by omitting "random" fields the we ordinarily convert, you're kind of breaking the contract. You can verify if an email address is invalid and will throw using the example in the SwiftMailer docs: $validator = new EmailValidator();
$validator->isValid("example@example.com", new RFCValidation()); //true So, I'd suggest:
|
I don't like it too, but obviously, we had problems with the conversions and this was the solution. It wasn't only the problem with the emails, but also with the dates, and even with the body. This all is based on real experience with implementation of msg viewer and tested on client files (170k+ files). |
I don't have a problem with it not throwing and with the conversion being lossy, but it needs to indicate to the caller that the conversion completed only partly. And, as noted, it needs to only catch the exceptions we're expecting and intentionally swallowing ( |
OK, I will try to rewrite it to something more useful, that will control the exceptions. |
I have implemented the catching of the exceptions on condition. Default behaviour is like previous. The exceptions can be muted, and in that case, all exceptions will be recorded to internal array and can be requested by getter method. |
This comment has been minimized.
This comment has been minimized.
This reverts commit 3a7c688.
OK, the formatting is fixed now. I reverted the previous commit and made the adjustments in Sublime, instead of PhpStorm... |
This is OK mostly. Thanks for your work. But I do have a quibble mucking with the interface by introducing an optional parameter. I think a reasonable fix would be to make the state of swallowing exceptions or not a property of the factory class. Therefore you call
Does that make sense/sound reasonable? You'd now write |
OK, I will think about it, as I need to pass it somehow to this construction: and this calls the Will this be acceptable? |
hmm it took me a while to understand what you're saying here because your PR doesn't currently include that functionality (passing the flag through so that it would apply to MSG attachments). At the moment your logic in the PR will just ignore/drop the whole attachment if it has an invalidity. So you've expanded the scope of things a bit! But yes you can do any of: change the |
Merged an amended version - PR38 |
This will allow us to convert msg files to eml file, even if the source uses some invalid email addresses or some of the data are missing at all.
Without this, it can fail on any of the headers, and thus prevent the conversion, and it's better to present at least something to user, than nothing.