The letter of affirmation is explained here. Before you get married in Thailand you will first need to prove that you are single. Each Embassy in Bangkok has their own procedures to verify that you are single so that they may provide you with an affidavit for the Thai government showing your status. Note that Embassy procedures do change so check with them first.
Letter of Affirmation
US Letter of Affirmation
If you are an American then the US Embassy in Bangkok or the US Consulate in Chiang Mai can issue you a letter of Affirmation or Freedom to Marry. The letter is usually issued on the same day or you have to come back the next day. You will need an original divorce decree or death certificate for your late spouse if you are widowed. The cost is about $30 per affidavit.
UK Letter of Affirmation
British nationals can obtain their letter or Freedom to Marry at the British Embassy in Bangkok. Much like the US you will need an original divorce decree if divorced or death certificate if you are widowed. Note that the Freedom to Marry letter is issued overnight however can also be obtained on the same day. The cost is about 3,600THB per affidavit at the Embassy. It is also important to note that the UK embassy request you to book an appointment.
Italian Letter of Affirmation
Italian citizens need to contact the Italians Embassy with their details at least 2 weeks before the letter is issued. You will need to provide them with all the details and your original divorce decree if divorced as well as a death certificate if widowed. After two weeks they will issue you the Freedom to Marry letter the same day.
Canadian Freedom to Marry
You have to contact the Canadian Embassy in Bangkok or the Canadian Consulate in Chiang Mai and provide them with all your original documents such as a death certificate if widowed and a divorce decree if divorced. The Freedom to Marry letter is issued in English or French. The cost is the equivalent of C$50 per affidavit and you can get the letter on the same day.
Swedish Freedom to Marry
The Swedish Embassy is a bit more complex. You need to show your single tax paper from the tax authority in Sweden with proof of income. You also need to give two references letter from non-family members in Sweden that know you are single. They also need to know your parents’ names and occupations. If you are divorced or widowed then original divorce decree and death certificate is needed. The process takes 1 day and the cost is THB500.
New Zealand Letter of Affirmation
If you are from New Zealand then the Embassy in Bangkok will issue you a Freedom to Marry and this is normally done overnight. The cost is about 850THB per affidavit. You will also need to provide the original divorce decree or death certificate if you are divorce or widowed. Note that the affirmation will need to be translated into Thai for the Thai District Office. Note that if you got divorced in Australia then you will need to have the original document certified at the Australian Embassy first. See also how to complete the Islamic affirmation letter in Thailand.
These are the normal procedures for most Western countries and most of the expats in Thailand. You need to contact the Embassy for more details or leave the marriage registration to an attorney in Bangkok or an Attorney in Phuket as it does drag on in red tape.