Send email in Python with Aruba [error 10061]

223 Views Asked by At

I am trying to send an email in python with my Aruba mailbox. The configuration is :

  • setting.py
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtps.aruba.it'
EMAIL_PORT = 465
EMAIL_HOST_USER = 'email'
EMAIL_HOST_PASSWORD = 'password'
EMAUL_USE_TLS = True
EMAIL_USE_SSL = False
  • the code that send the email
msg = MIMEMultipart()
msg['Subject'] = 'subject'
msg['From'] = 'from email'
msg['To'] = 'to email'

#some files I need to send
xlsx = MIMEApplication(open(str(newFilePath), 'rb').read())
xlsx.add_header('Content-Disposition', 'attachment', filename=str(newFileName))
msg.attach(xlsx)

server = smtplib.SMTP('smtps.aruba.it', 25)
server.connect("smtps.aruba.it", 465)
server.ehlo()
server.starttls()
server.ehlo()
server.login('email', "password")
server.sendmail('from email', 'to email', msg.as_string())
server.quit()

However, I receive this error: "Cannot connect to SMTP server 62.149.128.218 (62.149.128.218:25), connect error 10061'"

I couldn't find anything about it. What can it depend on?

0

There are 0 best solutions below