I know that is possible to send mails using the oracle-db by UTL_SMTP, and there are several examples of such usage everywhere.

My question is: Can I call the GNU/Unix/Linux Sendmail to perform a similar action?

  • 2
    Why do you want to do this? Look into the dbms_scheduler package which has support for invoking an external program. May 29, 2014 at 19:54
  • @Colin'tHart, thank you! I didn't know where to look for it (:
    – Mansueli
    May 29, 2014 at 20:13

1 Answer 1


Why do you want to use sendmail? Is it just because it is simpler than UTL_SMTP? You should really look into UTL_MAIL.

See this: http://www.orafaq.com/wiki/Send_mail_from_PL/SQL

To send mail from an Oracle db, you might:

  • Use UTL_TCP, way too low-level, old school, not recommended.
  • Call Unix Sendmail (external program) using DBMS Scheduler. Kind of complex -- you need to setup credentials to run OS processes. Anyone who has tried this knows it's not trivial. Technically possible, but why put yourself through the pain. I personally wouldn't do this.
  • Use UTL_SMTP, better than UTL_TCP, was the best approach pre-10g.
  • Custom mail proc that you write, which makes use of UTL_SMTP. Okay for 9i, but for 10g+ you'd just be reinventing the wheel, so use UTL_MAIL instead.
  • Use UTL_MAIL, simplest approach on 10g/11g/12c
  • If you are really bent on using sendmail and would be open to an asychronous/batch solution, consider creating a DIRECTORY that Oracle can write text files in MIME format into (via UTL_FILE), then set up a cron job that runs every 5 minutes which processes these files through sendmail and deletes them if successful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.