Looks like I have found an answer very long time back but didn't write it down.
So today I started investigating this again and decided to store the solution found somewhere.
It is interesting that this documentation has a small sentence answering this question.
https://help.salesforce.com/apex/HTViewSolution?id=000002490&language=en_US
Emails sent using setTargetObjectId() set against the user object do
not count against the SingleEmailMessage limit.
It is very interesting that if I run this code
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setToAddresses( new List<String>{'julfy@i.ua'} );
mail.setSubject( 'test 2' );
mail.setHtmlBody( 'test 2' );
Messaging.sendEmail( new Messaging.SingleEmailMessage[] { mail } );
it fails with error
Line: 14, Column: 1 System.EmailException: SendEmail failed. First
exception on row 0; first error: SINGLE_EMAIL_LIMIT_EXCEEDED, Email
limit exceeded: []
while if I execute the code
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setTargetObjectId( UserInfo.getUserId() );
mail.setSaveAsActivity( false );
mail.setSubject( 'test 2' );
mail.setHtmlBody( 'test 2' );
Messaging.sendEmail( new Messaging.SingleEmailMessage[] { mail } );
I see no errors.
Looks like someone else also has mentioned this here:
https://salesforce.stackexchange.com/a/17143/3716
However, that answer is undervoted and doesn't appear on the top on googling.