By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
DECLARE c UTL_SMTP.CONNECTION; PROCEDURE send_header(name IN VARCHAR2, header IN VARCHAR2) AS BEGIN UTL_SMTP.WRITE_DATA(c, name || ': ' || header || UTL_TCP.CRLF); END; BEGIN -- Open connection to SMTP gateway c := UTL_SMTP.OPEN_CONNECTION('smtp.server.acme.com'); UTL_SMTP.HELO(c, 'acme.com'); UTL_SMTP.MAIL(c, 'userA@acme.com'); UTL_SMTP.RCPT(c, 'userB@acme.com'); UTL_SMTP.OPEN_DATA(c); send_header('From', '"Oracle Admin"Feel free to modify this code sample for your needs. More information can be found in the Oracle documentation for the UTL_SMTP supplied PL/SQL package.
'); send_header('To', '"Bob Smith" '); send_header('Subject', 'Automated Database Email'); UTL_SMTP.WRITE_DATA(c, utl_tcp.CRLF || 'This is an automated email from the Oracle database.'); UTL_SMTP.WRITE_DATA(c, utl_tcp.CRLF || 'The database is working for you!'); UTL_SMTP.CLOSE_DATA(c); UTL_SMTP.QUIT(c); END; /
Dig Deeper on Oracle database backup and recovery
Related Q&A from Brian Peasland
Oracle expert Brian Peasland answers one reader's question about common pitfalls when connecting Oracle to outside programs.continue reading
One reader asks expert Brian Peasland a question about datafile sizes with the Oracle RMAN duplicate 10g command.continue reading
Managing parent table-child table relations in Oracle SQL environments is key to efficient programming.continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.