Menu

OAuth2 SMTP

2022-09-15
2024-07-19
  • Bastian Seidemann

    Hi,

    i try to send E-Mails using Oauth2 Microsoft SMTP.

    that is my iTop Mail Config:

    'email_transport' => 'SMTP_OAuth',
    
        'email_transport_smtp.encryption' => 'STARTTLS',
    
        'email_transport_smtp.host' => 'smtp.office365.com',
    
        'email_transport_smtp.port' => '587',
    
        'email_transport_smtp.username' => 'xxxxxxx@domain.de'
    

    That is what Microsoft needs to Authenticate against SMTP:

    Servername: smtp.office365.com
    Port: 587
    Verschlüsselungsmethode: STARTTLS
    

    The Answer i get on Mail Test is:

    Error: 'cannot connect to host; error = stream_socket_client(): unable to connect to tcp://smtp.office365.com:587 (Connection timed out) (errno = 0 )'
    

    i think the library does not support STARTTLS as Auth.

    is there someone getting Microsoft SMTP Oauth to work?

    Thanks!

     
  • Remi Delvaux

    Remi Delvaux - 2024-07-19

    in know it's old but have you find any workaround ?
    i try a lot but was not able to get it wroking
    and still use smtp.
    // email_transport: Mean to send emails: PHPMail (uses the function mail()), SMTP (implements the client protocol) or SMTP_OAuth (connect to the server using OAuth 2.0)
    // default: 'PHPMail'
    'email_transport' => 'SMTP',

    // email_transport_smtp.encryption: tls or ssl (optional)
    //  default: ''
    'email_transport_smtp.encryption' => 'tls',
    
    // email_transport_smtp.host: host name or IP address (optional)
    //  default: 'localhost'
    'email_transport_smtp.host' => 'smtp.office365.com',
    
    // email_transport_smtp.password: Authentication password (optional)
    //  default: ''
    'email_transport_smtp.password' => 'yourpassword',
    
    // email_transport_smtp.port: port number (optional)
    //  default: 25
    'email_transport_smtp.port' => 587,
    
    // email_transport_smtp.username: Authentication user (optional)
    //  default: ''
    'email_transport_smtp.username' => 'your mail',
    

    dont forget to add smtp auth to your user
    https://learn.microsoft.com/en-us/exchange/clients-and-mobile-in-exchange-online/authenticated-client-smtp-submission

     
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2024-07-19

    Do you have more info on your case, Remi?

    An exact error message, or does it just keep spinning or ...?
    Did you properly set up the OAuth 2.0 client?

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.