Skip to main content
Solved

How to use PythonEmailer with office 365

  • February 10, 2016
  • 5 replies
  • 92 views

erik_jan
Contributor
Forum|alt.badge.img+23

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

Best answer by brianatsafe

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.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

brianatsafe
Safer
Forum|alt.badge.img+13
  • Safer
  • Best Answer
  • February 11, 2016

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.


erik_jan
Contributor
Forum|alt.badge.img+23
  • Author
  • Contributor
  • February 11, 2016

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.


brianatsafe
Safer
Forum|alt.badge.img+13
  • Safer
  • February 11, 2016

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


erik_jan
Contributor
Forum|alt.badge.img+23
  • Author
  • Contributor
  • February 11, 2016

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?


brianatsafe
Safer
Forum|alt.badge.img+13
  • Safer
  • February 11, 2016

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!