J.R.s answer is perfect if you do know the gender your subject identifies with, and only their surname.
However, as the purpose of these email introductions is simply to show respect - it is common that you will not know for certain the person's gender (including if you only see their name, and try to infer their gender from this). In these situations, I feel it's worth giving extra care to your opening, to be gender neutral.
If the recipient has a professional title, use it
Firstly, as this is formal communication, until told otherwise, it is best to use the person's known honorifics. For example:
Dear Dr. Surname,
Dear Judge Surname,
Dear Baron/Baroness/Lord/Lady Surname,
These titles convey the most respect, and although some people may find it "too much", they will never risk being rude if used appropriately.
Note: As each title has very specific meanings, and some titles modify the name used - you should be very careful about using the honorific titles. It is unlikely you will be able to guess their title, unless you have seen it used elsewhere (for that specific person). Getting an honorific title wrong, may come across worse than not using it at all.
If you know their full name, use it.
Arguably, the second best case is to just use their entire name if you know it. This avoids any implied gender, and by using their surname - still comes across as respectful and formal.
Dear Firstname Surname,
Again, some care does need to be taken to use the correct order. In western cultures, it's common to use Firstname Surname, while other cultures (such as some Asian cultures) may prefer Surname Forname. Generally, you should use the name order they provided to you and not try to guess or re-arrange their name.
This is a relatively common format, and should not be surprising to any recipient who communicates with western cultures regularly.
If you only know their surname and not their gender
In this case, you have a real lack of information - which I'd argue is very unlikely in most cases. There are a few possible suggestions to use:
To whom it may concern,
This is a generic opening, that's commonly used when writing to a company or organisation - where multiple people may be able to respond to you. If you know the surname of the individual - this is likely inappropriate, but it's worth mentioning as a common, generic opening to letters.
Greetings,
This may seem like an odd choice - to completely remove their name from the letter. However, when in doubt - it is sometimes best just to make sure you don't get it wrong.
Opening a letter with "Greetings" or a similar non-specific phrase ("Salutations" used to be fairly common), will come across as less personal than other options. However, if you know so little of the person's name, then I'd suggest you may not actually have the information required to be more personal.
Dear Role,
(e.g.) Dear Colleague,
(e.g.) Dear Customer,
If the person you are writing to is in a certain role or capacity, it can also be appropriate and respectful to use their role as the opening. Again, this is impersonal - but it keeps the letter formal and professional, which if you lack further information on the person's name/gender, is a situation you just have to accept.
Recommend NOT using Dear Sir/Madam
It's worth a mention here, that as a last-resort some people will recommend the generic:
Dear Sir/Madam, (or)
Dear Mr/Mrs Surname
While these will not often cause great offence, there are a couple of gotchas to be aware of - which is why I would generally recommend against using them.
Firstly, the generic nature of this is not much better than just saying:
Dear valued recipient,
And is the form used by a lot of spam, junk mail - where the sender knows nothing about you.
Secondly, while it will only affect a small minority of people, you are implying that the recipient must be one of two genders. To those who identify as non-binary, while they will be "used to it", it definitely does not do the job of conveying respect - which is the entire point of including an opening line in the first place.
There are of course a plethora of common openings that are in use today, however - the above hopefully gives enough information on the pitfalls of each approach, that other openings can be judged at your discretion.
Again, it might seem like a lot of effort to be gender neutral (if you do not know their gender), when that will only affect a minority of people. But, it's worth remembering the purpose of the opening line - to set a good tone for the rest of the letter. If your opening line actually does the opposite of this, and shows disrespect - it has failed entirely.
Worth noting: If you know your recipient is non-binary, or has preferred openings, but do not know what those are - the scope of that issue is large enough to warrant a separate question entirely dedicated to it.