1

I am working on sending emails with python and have a decent grasp on that however I am struggling with using info from a CSV File. I have a piece of code:

 s.login('example@gmail.com', 'expassword')

that when used with a preset login and password works, it sends the email to my recipient, which is later set in my code, however as soon as I use the code:(chooses a random email and password from a CSV to send from(for a spam email demo))

with open ('C:/Filepath/randomsender.csv') as file:
    reader = csv.reader(file)
    sender = random.choice(list(reader))

followed by

s.login(sender)

I get an auth error because it cannot read the chosen line properly even though the result of sender is formatted the same as:

'example@gmail.com', 'expassword'
Aidan Hart
  • 15
  • 3

1 Answers1

0

If you want to pass list elements as position param, you need to unpack it.

this might help

e.g.

s.login(*sender)
waynelpu
  • 425
  • 3
  • 9