Thanks for the question, Mudasser.
Asked: January 23, 2020 - 11:47 am UTC
Answered by: Chris Saxon - Last updated: February 05, 2020 - 11:02 am UTC
Category: Database Development - Version: 12.1
Viewed 100+ times
I want to send email through PL/SQL by using utl_mail package, I have completed below steps
1. Installed scripts
2. granted execute to user
3. created ACL and granted access to user
4. Checked smtp server access through telnet
5. write below script
EXECUTE IMMEDIATE 'ALTER SESSION SET smtp_out_server = ''mysmtpserver.com:25''';
UTL_MAIL.send(sender => 'email@example.com',
recipients => 'firstname.lastname@example.org',
subject => 'Test Mail',
message => 'Hello World',
mime_type => 'text; charset=us-ascii');
6. Getting below error now
ORA-29279: SMTP permanent error: 550 XXXsmtpXX: Host xxx.xxx.xxx.xxx: No unauthenticated relaying permitted
and we said...
We're not taking reviews currently, so please try again later if you want to add a review.
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:
username varchar2(256) := 'guest';
password varchar2(256) := 'welcome';
c := utl_smtp.open_connection('rpang-pc2');
utl_smtp.command(c, 'AUTH LOGIN');
Then continue to use UTL_SMTP to send the mail. MOS note 885522.1 has a complete example if you want one.