Forums

Resolved
0 votes
Hi
I'm trying to configure SMTP notification parameters in Webconfig GUI > System > Settings with my O365 credentials
ClearOS version: 7.4

Following recommendations from Microsoft, i setup like this
SMTP Hostname: smtp.office365.com
Port: 587
Encryption: SSL or TLS (cannot find STARTTLS in GUI)
myusername / mystrongpwd

Unfortunately it does not work with warning message:
The SMTP connection failed to start [ssl://smtp.office365.com:587]: fsockopen returned Error Number 0 and Error String ''

here is my /etc/postfix/main.cf
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = may
relayhost = [smtp.office365.com]:587
smtp_use_tls = yes
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

sender_canonical_classes = envelope_sender, header_sender
sender_canonical_maps = regexp:/etc/postfix/sender_canonical_maps
smtp_header_checks = regexp:/etc/postfix/header_check

and my /etc/postfix/sasl_passwd
[smtp.office365.com]:587 credential@mydomain.fr:mystrongpwd

Any idea, what's wrong with such parameters ?
Any help would be greatly appreciated...

All my best,
Phil
Saturday, February 03 2018, 09:08 AM
Share this post:
Responses (4)
  • Accepted Answer

    Saturday, October 27 2018, 06:46 PM - #Permalink
    Resolved
    0 votes
    Nick,

    As this seems related to my issues, I tried your same settings. After setting up webconfig and testing, the reply was "Send failed."

    Not much info...

    Thanks,
    Drew VS
    The reply is currently minimized Show
  • Accepted Answer

    Monday, February 05 2018, 10:42 AM - #Permalink
    Resolved
    0 votes
    You can even have gmail and outlook365 together. Google "smtp_sender_dependent_authentication" for various reference. Postfix's documentation is here - scroll down to the "Configuring Sender-Dependent SASL authentication" section. What it does not say is that is that you can have a catch-all at the end. I have in my /etc/postfix/relayhost_map file something like:
    user1@gmail.com	[smtp.gmail.com]:587
    user2@another_isp.com [smtp.gmail.com]:587
    * [smtp.ntlworld.com]:25
    Although I am not sure if the catch-all is needed if you have a "relayhost" defined as well as I think this will be used by default.

    There are plenty of other references.
    The reply is currently minimized Show
  • Accepted Answer

    Monday, February 05 2018, 09:28 AM - #Permalink
    Resolved
    0 votes
    Hi Nick,

    Thanks a million for your answer cause i finally solve the issue for both Office365 and gmail.com

    Here what I've done to manage it.

    edit /etc/postfix/main.cf and add the following lines at the end of the file

    relayhost = [smtp.office365.com]:587
    smtp_use_tls = yes
    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt
    smtp_sasl_security_options = noanonymous
    smtp_sasl_tls_security_options = noanonymous

    edit /etc/postfix/sasl_passwd and add the following parameter

    [smtp.office365.com]:587 mycredential@domain.com:mystrongpasswd

    then a few commands to apply configuration and secure the pwd
    postmap /etc/postfix/sasl_passwd
    chown root:postfix /etc/postfix/sasl_passwd*
    chmod 640 /etc/postfix/sasl_passwd*
    systemctl reload postfix

    and finally back to webconfig:

    System > Settings > Email parameters
    SMTP Hostname / IP: localhost
    Port SMTP: 25
    Encryption: none
    user SMTP: -> leave field empty !!
    password SMTP: -> leave field empty !!
    sender email: mycontact@domain.com


    It works both with office 365 and gmail account. juste replace smtp.office365.com with smtp.gmail.com


    Hope it helps the community...

    All my best
    The reply is currently minimized Show
  • Accepted Answer

    Saturday, February 03 2018, 10:04 AM - #Permalink
    Resolved
    0 votes
    I can't get mine to work with GMail either. It works directly to me through my own mail server. As a workround, you may be able to use this document to configure postfix, and then in the Settings app for your SMTP Hostname/IP, set it to 127.0.0.1 or whatever your server name is and use port 25 without authentication. Postfix should then look after the relaying to outlook365. Your Sender Address will almost certainly have to be your outlook365 e-mail addres for this to work.
    The reply is currently minimized Show
Your Reply