There are a couple possible issues that lead to confusion when applying the algorithm for constructing chords in key.
The first is proper name convention for the notes. In equal tempered tuning (standard fretted guitar, piano, etc) the C# and the Db are enharmonic. They are the exact same frequency and played the same way. For all intents and purposes they are the same. In just tuning they may not be. The letter names and degrees of the major scale for any key are related by a 1-to-1 correspondence. The letter names ALWAYS follow the sequence of the "musical alphabet" {A, B, C, D, E, F, G} repeat forever. For example to get the proper letter names for the E maj scale you simply take the sequence
{E, F, G, A, B, C, D, E}
Now these are just the proper "letter names". To make the maj scale you need to include the accidentals required to get the pattern of steps {W, W, H, W, W, W, H} between the notes (W = whole, H = half). This gives you,
{E, F#, G#, A, B, C#, D#, E}
Consider the 6th degree of the E maj scale. This is C# and NOT Db. Not simply because this key has sharps and not flats but because the letter name in the 6th position of the sequence is C. If you want to make an augmented 6th in the key of E you need to write Cx or C##. On an equal tempered instrument you will be playing D natural but you'd get points off a music theory test if you said that D natural is the aug 6th of E maj.
The second thing is the application of the formula for chords. As we build chords we always reference the formula to the major scale starting on the "One" or root of the chord. Even if you are in the key of C maj, when you build an A min chord you apply the formula to the A maj scale. The formulas are key independent, a few examples are provided below. X = any note,
X (or X maj) = {1, 3, 5}
X- (or X min) = {1, b3, 5}
X7 = {1, 3, 5, b7}
X-7(b5) = {1, b3, b5, b7}
You see the pattern. This formula may seem confusing if you know your modes. Some players may want to build a D-7 in the key of C and just say "why not use Dorian as the mode and say the formula is {1, 3, 5 ,7} of the Dorian mode". Well this would lead to a lot of ambiguity when it comes to describing the structure of chords independently of key or mode as you have the same construction in the Phrygian and Aeolian modes. And this brings us to the third possible point...
Third, there is a natural relationship between 7th chords in ANY key. In other words one can build a 7th chord on each note of the maj scale just as one can build one of the 7 diatonic modes starting at each of the 7 degrees of the maj scale. These are,
I maj7
ii -7
iii -7
IV maj7
V7
vi -7
vii -7(b5)
All these chords are in the same key, no accidentals required. This sequence is used to harmonize melodies in key and naturally contains features like resolution (V7-->I, contains the movement 7-->8, and 4-->3).
In general one is free to put any chord any where, which may violate the key you are in. For example, it is common in Jazz progressions for the vii chord to be a dom7 rather than a min7 (as would be "natural" in any key).
So when you say you are applying the formula for a chord in the key of Emin you have to ask yourself whether you are (1) trying to build a dom7 chord on the "tonic" of the key of Emin, or (2) trying to find the seventh chord that naturally occurs on the tonic of Emin, or (3) trying to find the V7 chord of Emin (as many have interpreted your question). If you are trying option 1 then the chord formula is independent of key (actually it always is). If you are trying option (3) then you walk up to the 5th note of the Emin scale and simply find what 7th chord is contained in the minor scale. By the way this would NOT be a dom7 chord if you use the natural minor scale it would be a -7 chord.
Now this brings us to the fourth point. There is no V7 chord in the minor scale. To create the feeling of a resolution in a minor key we alter the scale to create either harmonic minor (which has the natural or major 7th in it) or melodic minor (which has a maj 6 and 7 in the ascending pattern and min 6 and 7 in the descending pattern). Using these modes changes the 7th chords that are embedded in the minor key and creates the classic V7 --> I feel in that key (which may be expressed as V7-->i treating the "One" as the first note of the minor key).
It seems to me that you were trying to build a dom7 chord in E minor starting on E and applying the formula {1, 3, 5, b7} to the degrees of the minor key and this is simply not how the formula works. Applying this to a minor scale without respecting the relative intervals indicated in the formula would give {1, b3, 5, bb7}. Again, the formula for chords that you seem to be using is key and mode independent and is referenced to a Maj scale starting on the root.