Strictly speaking you should only be able to apply for e-visa in the country where you have residence, and with residence is meant your permanent adress.
But as with much else about Thailand, what is written, does not always follow practice.
“This info can be found at several Thai Embassy websites in the visa section:
“WHO CAN APPLY FOR E-VISA WITH THE ROYAL THAI EMBASSY
Residents of xxxxx who currently residing in these countries may apply for e-visa with the Royal Thai Embassy in xxxxx through
****************************
.
Proof of residency are required.
Those currently residing in other countries should contact the Royal Thai Embassy in their respective countries.
Nationals of xxxxx who are currently traveling in Thailand cannot apply for e-visa with the Royal Thai Embassy in xxxxx through
*****************************
They must contact the Thai Immigration Bureau for visa matters.
Nationals of xxxxx who are currently traveling in other countries and wish to travel to Thailand cannot apply for e-visa with the Royal Thai Embassy in xxxxx. They may either enter Thailand under 30-day tourist visa exemption scheme or contact the Royal Thai Embassy in the countries they are traveling in if they wish to stay in Thailand for longer than the tourist visa exemption scheme allowed. If they wish to apply with the Royal Thai Embassy in xxxxx, those nationals of xxxxx must first return to their respective countries before applying.”