Skip to Main Content
  • Questions
  • ORA-29279: SMTP permanent error: 550 XXXsmtpXX: Host xxx.xxx.xxx.xxx: No unauthenticated relaying permitted

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, Mudasser.

Asked: January 23, 2020 - 11:47 am UTC

Last updated: June 04, 2024 - 12:57 pm UTC

Version: 12.1

Viewed 100K+ times! This question is

You Asked

Hi Tom,

I want to send email through PL/SQL by using utl_mail package, I have completed below steps

1. Installed scripts

@$ORACLE_HOME/rdbms/admin/utlmail.sql
@$ORACLE_HOME/rdbms/admin/prvtmail.plb


2. granted execute to user

3. created ACL and granted access to user

4. Checked smtp server access through telnet

5. write below script

BEGIN

EXECUTE IMMEDIATE 'ALTER SESSION SET smtp_out_server = ''mysmtpserver.com:25''';

UTL_MAIL.send(sender => 'sender@mysmtpserver.com',
recipients => 'muftisb@gmail.com',
subject => 'Test Mail',
message => 'Hello World',
mime_type => 'text; charset=us-ascii');
END;
/


6. Getting below error now

ORA-29279: SMTP permanent error: 550 XXXsmtpXX: Host xxx.xxx.xxx.xxx: No unauthenticated relaying permitted

Regards,
Mudasser Mufti


and Chris said...

You're receiving the 550 error from the SMTP server.

No unauthenticated relaying permitted means you have to be authenticated with the server to send email. There's no option to do this in UTL_mail at the moment. So you'll have to use UTL_SMTP instead.

So you need to start the process like this:

DECLARE
c utl_smtp.connection;
r utl_smtp.replies;
username varchar2(256) := 'guest';
password varchar2(256) := 'welcome';
BEGIN
c := utl_smtp.open_connection('rpang-pc2');
utl_smtp.ehlo(c, 'us.oracle.com');
utl_smtp.command(c, 'AUTH LOGIN');
utl_smtp.command(c, demo_base64.encode(utl_raw.cast_to_raw(username)));
utl_smtp.command(c, demo_base64.encode(utl_raw.cast_to_raw(password)));


Then continue to use UTL_SMTP to send the mail. MOS note 885522.1 has a complete example if you want one.

Rating

  (8 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Can you share code for sending mail using office 365 mail

A reader, June 04, 2024 - 6:11 am UTC

Can you share code for sending mail using office 365 mail
Chris Saxon
June 04, 2024 - 12:57 pm UTC

MOS note 2980360.1 has full details. In brief, you need to:

Create a Wallet. Then, import the CA about website "smtp.office365.com".
Setup ACL with DBMS_NETWORK_ACL_ADMIN.CREATE_ACL to allow the database to contact this
Use UTL_SMTP to open a connection to the mail server and send the mail

A reader, June 12, 2024 - 4:14 am UTC


Djfhvdhgf

A reader, June 20, 2024 - 4:34 pm UTC


A reader, July 09, 2024 - 12:45 am UTC


A reader, July 09, 2024 - 12:45 am UTC


A reader, July 09, 2024 - 12:45 am UTC


A reader, July 09, 2024 - 12:45 am UTC


More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library