the code below outputs a string of emails (e.g. ['[EMAIL PROTECTED]', '[EMAIL PROTECTED]']
i would like to somehow send an email to everyone on the string of emails telling them 'thanks for emailing me' anyone know how to do this? much thanks ahead of time. from imaplib import * import getpass, re m = IMAP4("xxxxxxxxxxxxxx") m.login('xxxxx', 'xxxxxx') m.select('Inbox') status, data = m.search(None,'(SUBJECT "BIKES")') assert status=='OK', "Error. Message: %s"%data data = data[0] #you get your results in a list and search returns only one result assert data,"No results" #cool, we have results, but IMAP's search command only returns IDs so we have to fetch #msgs now status,senders = m.fetch(data.replace(' ',','),'(BODY.PEEK[HEADER.FIELDS (FROM)])') assert status=='OK', "Error. Message: %s"%data ''.join([''.join(t) for t in senders]) senderlist =''.join([''.join(t) for t in senders]) emails = re.findall('([EMAIL PROTECTED])', senderlist) print emails -- http://mail.python.org/mailman/listinfo/python-list