Let us see how we can utilize UTL_MAIL to send Email form PL/SQL. Using the UTL_MAIL package is pretty straight forward.
Check the below example.

[sql]
begin
utl_mail.send(
sender => ‘oracle@mydomain.com’,
recipients => ‘user1@mydomain.com,user2@mydomain.com’,
subject => ‘Test Mail from my Instance’,
message => ‘Test message’
);
end;
[/sql]

As you can see there are 4 different entities that you need to consider.

Let me know if you have any questions on the topic. Your feedback and suggestions are highly appreciated.

2 Responses

    1. Hi Sankar,

      I believe you can. However you will have to give the contents for the file in the UTL_MAIL code snippet itself. You may not be able to just give the path name and expect it to be attached.

      What i usually do is spool the file to a directory and then use uuencode or mailx or mail (unix commands) to attach the file to the email. You can also attach file directory from the output directory using any of the above mentioned unix commands.

      Let me know if you have questions.

      Thanks,
      Arun

Leave a Reply

Your email address will not be published. Required fields are marked *