0

(user_mail, ','.join(recipient), mail.as_string())

The above code produces error of expected string but tuple found. How should I fix this? Any solution?

Community
  • 1
  • 1
  • 2
    Some more code would help us to help you – Arpit Solanki Jun 17 '17 at 19:31
  • recipient = [] db = MySQLdb.connect(host = "', user = ''', paswd=''', db=''') cursor = db.cursor() cursor.execute('select email from user where email is not null') rows=cursor.fetchall() for item in rows: recipient.append(item) – Erica Elsie Mi-in Jun 17 '17 at 19:40
  • I am asking for the code that could explain the problem and help us to find the solution. You can post the code that sends email like smtplib.login and other codes. – Arpit Solanki Jun 17 '17 at 19:43
  • mailServer.sendMail(user_mail, ','.join(recipient), mail.as_string()) will this do? it says this line is having problem. I try to read emails from database and make python to send email with attachment to them. – Erica Elsie Mi-in Jun 17 '17 at 19:47

1 Answers1

0

You must specify recipients in a string . Below is an example you can specify recipients like this.

user_email = "someone@example.com"
recipients =  ["email1, email2, email3"]
Arpit Solanki
  • 9,567
  • 3
  • 41
  • 57