Solved

How to use PythonEmailer with office 365

  • 10 February 2016
  • 5 replies
  • 15 views

Userlevel 2
Badge +16

I am trying to send an email using the PythonEmailer.

This works fine if I use the smtp.gmail.com server.

But I can not get it to work with the smtp.office365.com server TLS and port 587).

Has anybody got that working.

Any help is appreciated.

This is the error message I am getting:

Python Exception <SMTPException>: SMTP AUTH extension not supported by server.

Error encountered while calling function `email'

f_8(PythonFactory): PythonFactory failed to process feature

icon

Best answer by brianatsafe 11 February 2016, 19:59

View original

5 replies

Badge +9

Hi @erik_jan,

Can you try switching from TLS to SSL in the transformer parameters? See if that works for you.

Their documentation here: https://support.office.com/en-us/article/Outlook-s...

suggests that some clients refer to implicit TLS as SSL.

Userlevel 2
Badge +16

Hi @erik_jan,

Can you try switching from TLS to SSL in the transformer parameters? See if that works for you.

Their documentation here: https://support.office.com/en-us/article/Outlook-s...

suggests that some clients refer to implicit TLS as SSL.

Hi Brian,

I have tried all combinations available:

TLS and SSL,

SMTP, POP and IMAP

ports for SMTP (587), IMAP (993) and POP (995)

But no combination worked.

Badge +9

Hi Brian,

I have tried all combinations available:

TLS and SSL, 

SMTP, POP and IMAP

ports for SMTP (587), IMAP (993) and POP (995)

But no combination worked.

Hi @erik_jan ,

Perhaps the python code within the transformer could be improved.  Can you try to add the following to the PythonCaller code within the custom transformer:

smtp.ehlo() 
smtp.starttls() 
smtp.ehlo()

Place it here:

 # Determine how we want to begin the connection
    if (connection_type=='TLS'):
        smtp=smtplib.SMTP(server,port)
        smtp.ehlo()
        smtp.starttls()
        smtp.ehlo()
    else:

Found from: http://stackoverflow.com/questions/64505/sending-mail-from-python-using-smtp

Userlevel 2
Badge +16

Hi @erik_jan ,

Perhaps the python code within the transformer could be improved.  Can you try to add the following to the PythonCaller code within the custom transformer:

smtp.ehlo() 
smtp.starttls() 
smtp.ehlo()

Place it here:

 # Determine how we want to begin the connection
    if (connection_type=='TLS'):
        smtp=smtplib.SMTP(server,port)
        smtp.ehlo()
        smtp.starttls()
        smtp.ehlo()
    else:

Found from: http://stackoverflow.com/questions/64505/sending-mail-from-python-using-smtp

Thanks @BrianAtSafe

That works fine.

Will this be implemented in the FME Store version of the PythonEmailer?

Badge +9

Hi @erik_jan,

Can you try switching from TLS to SSL in the transformer parameters? See if that works for you.

Their documentation here: https://support.office.com/en-us/article/Outlook-s...

suggests that some clients refer to implicit TLS as SSL.

Absolutely, I will make sure we look at implementing this enhancement. I'm glad it worked for you!

Reply