Below is the query which will export all the email id of the records of mytable into a text file.
FROM mytable where
Opted = true
INTO OUTFILE 'C:/MyOptedUserEmail.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
For further help read this article http://www.tech-recipes.com/rx/1475/save-mysql-query-results-into-a-text-or-csv-file/