Question

I have a requirement to send an email,I have successfully sent email with below code to send email with gmail smtp.gmail.com:587 as smtp server.But i am getting error with smtpout.asia.secureserver.net my following code

import smtplib

def sendemail(to_addr_list='abcd.123@xxxxx.com', cc_addr_list='abcd.3214@xxxxxx.com',
          subject='Test mail', message='this is a test mail', from_addr='TestAddress',
          login='user123@xxxx.co', password='xxxxxxxx',
          smtpserver='smtpout.asia.secureserver.net:25'):
    header  = 'From: %s\n' % from_addr
    header += 'To: %s\n' % ','.join(to_addr_list)
    header += 'Cc: %s\n' % ','.join(cc_addr_list)
    header += 'Subject: %s\n\n' % subject
    message = header + message

    server = smtplib.SMTP(smtpserver)
    server.starttls()
    server.login(login,password)
    problems = server.sendmail(from_addr, to_addr_list, message)
    server.quit()
    return problems

sendemail()

I am getting the following error

raise SMTPException("STARTTLS extension not supported by server.") smtplib.SMTPException: STARTTLS extension not supported by server.

How to solve this.?Thanks in advance!

Was it helpful?

Solution 2

I have sent email with godaddy secureserver with the below code

import smtplib

to = 'to address'
user = 'your_mail_id'#your secureserver mail_id(godaddy)
pwd = 'your_password'
smtpserver = smtplib.SMTP("smtpout.asia.secureserver.net",80)
smtpserver.ehlo
smtpserver.login(user, pwd)
header = 'To:' + to + '\n' + 'From: ' + user + '\n' + 'Subject:testing \n'
print header
msg = header + '\n Thank you for registring.\n\n'
smtpserver.sendmail(user, to, msg)
print 'done!'
smtpserver.close()

OTHER TIPS

The error message is self-explaining -- the specified server doesn't support explicit TLS (STARTTLS command) on given port. This can mean that you need to connect to other port (eg. 587) to have explicit TLS or that you need to connect to some other port (465) using implicit TLS mode. Check server documentation for details.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top