I'm on a work network. I want to be able to download the attachment from coming from a specific email address to my local directory. But, for that first I need to be able to connect to the mail server. I'm doing the following to connect:
self.connection = imaplib.IMAP4_SSL(mail_server)
self.connection.login(username, password)
self.connection.select(readonly=False)
However the above gives me "Connection Refused error". However, when I do this:
mail_server=smtplib.SMTP('smtp.something.com')
print(mail_server)
It makes the connection. Is there a way I could use SMTP
instead of imaplib.IMAP4_SSL(mail_server)
to be able to download attachments from email? Or some other work around?