[Solved] UNKNOWN_EXCEPTION, List has no rows

Miguel Asks: UNKNOWN_EXCEPTION, List has no rows
I have the following error when trying to send an email.

System.EmailException: SendEmail failed. First exception on row 0; first >error: UNKNOWN_EXCEPTION, List has no rows for assignment to SObject: []

Code:
    List<User> users = [SELECT Name, Email, Id FROM User WHERE Recipient__c = TRUE and isActive = TRUE];
    EmailTemplate et = [SELECT id FROM EmailTemplate WHERE DeveloperName='Advisor'];

    for(User u : users) {
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

        mail.setTargetObjectId(u.Id);
        mail.setSenderDisplayName('Salesforce');
        mail.setUseSignature(false);
        mail.setBccSender(false);
        mail.setSaveAsActivity(false);
        mail.setTemplateId(et.id);

        Messaging.SendEmailResult[] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
    }

The list users contains at least one record and the Emailtemplate is not null.

This is the result of the mail system debug:

(Messaging.SingleEmailMessage[ getBccAddresses=null; getCcAddresses=null; getCharset=null; getEntityAttachments=null; getFileAttachments=null; getHtmlBody=null; getInReplyTo=null; getOptOutPolicy=SEND; getOrgWideEmailAddressId=null; getPlainTextBody=null; getReferences=null; getTargetObjectId=005D0XXXXXXXXXuIAE; getTemplateId=00XD0XXXXXXXXcbMAA; getToAddresses=null; getWhatId=null; isTreatBodiesAsTemplate=false; isTreatTargetObjectAsRecipient=true; isUserMail=true; ])

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.