- Newest
- Most votes
- Most comments
It is not possible to use UTL_SMTP from Oracle RDS directly over port 25. Port 25 is blocked by default in AWS VPCs to prevent spam.
As an alternative:
You can use an intermediate EC2 instance with UTL_HTTP + a Web API. Create an HTTP/HTTPS endpoint to receive email data. From RDS, use UTL_HTTP to send the request to the endpoint, and then the EC2 instance sends the email via SMTP.
or
Use Amazon SES in combination with a Lambda function or EC2 instance.
Yes, it is possible to use a local SMTP server to send mail via the UTL_SMTP package through port 25 on Amazon RDS for Oracle. However, there are some important considerations and potential restrictions to be aware of:
-
By default, AWS restricts outbound traffic on port 25 for RDS instances. This restriction is in place to prevent potential spam issues.
-
To use port 25 for SMTP, you need to request the removal of this restriction. You can do this by submitting a request to AWS Support using the "Request to remove email sending limitations" form. It's important to note that processing this request can take up to 48 hours.
-
After the port 25 restriction is removed, you'll need to configure the SMTP server by setting the SMTP_OUT_SERVER parameter. This can be done at the session level or as a default for the DB instance using a DB parameter group.
-
When using UTL_SMTP, you'll need to install the required scripts and then use the package's procedures to open a connection to the SMTP server, initiate the handshake, set sender and recipient details, add the message content, and terminate the SMTP transaction.
-
It's worth noting that while UTL_SMTP is available, Oracle also provides the UTL_MAIL package, which is generally easier to use and supports attachments. UTL_MAIL is recommended for most cases unless you have a specific need for UTL_SMTP.
-
Keep in mind that there are some limitations when using these packages on RDS, such as lack of Transport Layer Security (TLS) encryption and no SMTP server authentication.
Remember to consider security implications when opening port 25, and ensure that your use case complies with AWS policies and best practices for email sending.
Sources
Oracle UTL_MAIL - Amazon Relational Database Service
Send notifications for an Amazon RDS for SQL Server database instance by using an on-premises SMTP server and Database Mail - AWS Prescriptive Guidance
Oracle UTL_MAIL or UTL_SMTP and Amazon Simple Notification Service - Oracle to Aurora MySQL Migration Playbook
Using Database Mail on Amazon RDS for SQL Server - Amazon Relational Database Service
Relevant content
- asked 5 years ago
- asked a year ago
- AWS OFFICIALUpdated a year ago

https://support.console.aws.amazon.com/support/contacts#/rdns-limits Is this the link to be used? It seems it's only for EC2 and not for RDS