As a Portuguese speaker, I would pronounce both pan (/pæn/) and pen (/pɛn/) the same.
In what can I base my pronunciation so I don't mistakenly pronounce these words the same again?
First, it might help to listen to the difference between the two words, since Portuguese may have different vowel sounds. An audio clip for pen can be found here. A similar audio clip for pan is here.
Next, the two vowel sounds are represented differently in the International Phonetic Alphabet (IPA). However, since the IPA represents all the sounds in every language, there are words from Portuguese which can show the difference. First, the sound from pen is written /pɛn/
, which sounds like the Portuguese word for "coffee", or café.
Depending on your dialect, the sound from pan may be very similar. Wikipedia notes that the vowel sound from pan sounds like the first vowel of the Portuguese pedra, but that this vowel may also seem very close to the sound from pen. If this is the case for you, I suggest listening to the other words from this page, which provide words from other languages which use the same vowel. It could help you hear the difference.
Hopefully hearing the vowel sounds on their own, as well in context (in perhaps another language you already know) will help you learn to pronounce them. Otherwise, a speech therapist could possibly help you learn to form the vowels differently.
Simchona has already explained the difference between /æ/ and /ɛ/ with reference Portuguese, but I'll shed some light on how to articulate those vowels.
To begin with, here's the vowel chart:
This chart depicts a schematisation of two dimensions of tongue movement, demarcating the boundaries of the vowel articulatory space within the oral cavity. The slanted line to the left marks vertical displacement of the front of the tongue, showing us different degrees of open/close approximation i.e. how far or near the tongue is positioned from the roof of the mouth.
The horizontal lines mark vowel backness i.e. whether the highest part of the tongue is positioned in the front or the back of the mouth.
There's another feature called vowel roundedness which refers to the amount of rounding in the lips during the articulation of a vowel. In the chart, some vowels occur in pairs such as [i, y], [ɨ, ʉ], [ɛ, œ] etc., the ones to the right side are rounded (the lips are rounded while producing that vowel) whereas those to the left side are unrounded (unrounded lips).
[Some information about the vowel chart has been adapted from Understanding Phonetics by Patricia Ashby]
[ɛ] is called open-mid, front, unrounded vowel while [æ] is called near-open, front, unrounded vowel:
If you look at the vowel chart, you will see that [æ] is located a bit lower than [ɛ]. It means the main difference is that [æ] is a bit more open than [ɛ].
In [ɛ], the tongue is positioned one third of the way from an open vowel [a] to a close vowel [i] (the vowel in 'see') whereas in [æ], the tongue is positioned similarly to an open vowel [a], but slightly more constricted.
In British Received Pronunciation, the vowel of "pan" is at least as close to [a] as to [æ], which is why some are now adopting /a/ as the representation for the phoneme:
"The position of trap on our plot (figure 1) seems to unequivocally support Cruttenden’s (2014) decision to adopt /a/ as the symbol for it, but this is probably the least controversial of our findings" Bjelakovic, A. The Vowels of contemporary RP. 2016 ( https://www.cambridge.org/core/journals/english-language-and-linguistics/article/vowels-of-contemporary-rp-vowel-formant-measurements-for-bbc-newsreaders-1/3109BF90B3630215DAABD95111C3DD9C ).
In Portuguese, [a] is found in words like "pacto".
Therefore, it would make sense to pronounce "pan" as [pan] if you find it difficult to produce [æ].