Generally, if you want upvotes, you should make sure the Q&A pair provides long-term value.
Some simple steps can help with that:
For the answer:
- Make sure it's clear what the actual problem was (don't provide just a solution)
- Provide a solution that's both understandable, and generalizable to others experiencing the same error
- Make sure to explain the solution, so others understand how the problem was solved
For the question:
- Make sure the question is unique, and not a duplicate
- Make sure the question is findable to others searching for the same problem
- Make sure the question is useful to others, so not highly localized (previously, we had a close reason for too localized questions)
Often, this will mean you have to edit question. It's great you have >2K rep, so you can do this without requiring their approval. You often have to rewrite questions with titles like why can't I send mail to my clients to something that will help others experiencing the same problem find it (something like how to solve Bar error when sending mail with Foo), and add appropriate tags.
If a question is not findable, or is a duplicate, your answer provides no value to anyone but the person asking it, so it will be hard to get upvotes. Quite often, the question is more important for upvotes on the answer than the answer itself. But luckily, you're free to improve the question, and should not hesitate to rewrite it to make it more generalizable and findable.
Another factor for upvotes on answers unfortunately is the rep of the person asking the question. If it's below the rep required to upvote, you can be sure the one asking is not going to upvote your answer. But this shouldn't be an important consideration when answering questions.