jpatsg wrote:But why would your code bother scanning an attachment at all (if that's what you meant)? Wouldn't it be better to just not do that?
Developers usually use the simplest possible working solution. Adding skipping algorithm, would require extra work, even if it would save CPU.
Optimizations are interesting trade-off, and daily battle.
- No optimizations, performance could be extreme poor.
- Too many optimizations, product will be never launched, because it's not ready yet.
Often it's better to ignore optimizations until it's clear that something seems to be broken (performing too badly) unless it's fixed.
In theory, replacing string in attachment could break it. So skipping attachments, would be wise in that sense too. After encoding it's highly unlikely but still possible that message contains just that right string. Change of course get's higher if e-mail address is shorter and attachment is larger. Except that base64 encoding doesn't include @ character at all. So it shoulnd't be a real world problem.