Waves, of wavelength lambda, transmit poorly through apertures of dimensions L << lambda. Here it is shown that coupling of a subwavelength aperture to an electromagnetic oscillator makes it possible for a focused, diffraction-limited beam that impinges on the aperture to undergo perfect transmission. Ignoring non-radiative losses, and for apertures with closed boundaries in a metallic screen, the transmitted power at the oscillator's natural frequency is enhanced by a factor of (lambda/l)(6) compared with the nonresonant case. As a nontrivial extension to apertures with open boundaries, an analytically solvable problem is introduced and analyzed, which involves a pair of arbitrarily small slits in a two-dimensional waveguide. The system displays perfect transmission at a frequency corresponding to that of a quasilocalized, cavitylike mode bound to the slits, the frequency of which is below that of the cutoff mode of the continuum. In contrast, and remarkably, the Fabry-Perot-like resonance with the extended cutoff mode leads to imperfect transmission, comparable to that of an individual, nonresonated slit. An explanation of this single-slit-like behavior is presented, which also applies to the closely related phenomenon of light funneling concerning transmission through subwavelength channels [see F. Pardo et al., Light Funneling Mechanism Explained by Magnetoelectric Interference, Phys. Rev. Lett. 107, 093902 (2011), and references therein].