Hi,
My outlook email migrated to office 365 with hybrid mode.Now i am trying to send email using UTL_SMTP package (OAuth).
I got an error message “Certificate validation failure”
Please check and let me know, what i am doing wrong. If you need more information, please let me know.
Note: I am using Oracle 19c (19.3.0.0.0).
Code
DECLARE
username VARCHAR2(50) := 'o365_user_name@mydomain.com';
password VARCHAR2(50) := 'o365_password';
sender VARCHAR2(50) := 'my_sender_email@mydomain.com';
recipient VARCHAR2(50) := 'to_email@mydomain.com';
subject VARCHAR2(100) := 'Test Email using O365';
message VARCHAR2(32000) := 'This is a send from non prod env.';
mailhost VARCHAR2(30) := 'smtp.office365.com';
mailport NUMBER := 587;
mail_conn UTL_SMTP.CONNECTION;
BEGIN
mail_conn := UTL_SMTP.OPEN_CONNECTION(mailhost, mailport);
UTL_SMTP.HELO(mail_conn, mailhost);
UTL_SMTP.STARTTLS(mail_conn);
UTL_SMTP.AUTH(mail_conn, username, password, 'LOGIN');
UTL_SMTP.MAIL(mail_conn, sender);
UTL_SMTP.RCPT(mail_conn, recipient);
UTL_SMTP.DATA(mail_conn, 'Subject:'||subject||UTL_TCP.CRLF||UTL_TCP.CRLF||message);
UTL_SMTP.QUIT(mail_conn);
END;
/

Thanks,
Manikandan