Install Postfix. This is easier said than done. I found that my current install of Postfix was complete corrupted, so I needed to 100% purge/uninstall any old configurations attempted with Postfix and anything including Dovecot.
When installing Postfix from scratch, all you need to do is issue the following command:
sudo aptitude install postfix
This will walk you through some very basic prompts and create an initial /etc/postfix/main.cf configuration. The good thing is, to get this running quickly there is very little that needs to be changed in this file.
sudo vi /etc/postfix/main.cf and edit the following:
Find the mydestination = line. This line will probably look something like this:
mydestination = hostname.com, machinename.localdomain, localhost.localdomain, localhost
Just make sure hostname.com contains the domain of the machine you are using.
Find the mynetworks = line, it probably looks like this:
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
To enable relaying from the local network (assuming your local network is 192.168.1.*, change to the following):
mynetworks = 192.168.1.0/24,127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
Find myhostname =
Change to a real domain name such as:
myhostname = mail.hostname.com
The reason for doing this is some mail relays do not accept mail relayed from an unknown domain.
That’s it. Run the following commands to restart Postfix:
postfix start postfix stop postfix reload
Test Postfix by telnetting locally into the SMTP server:
telnet localhost 25
You should see something like this:
Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 mail.hostname.com ESMTP Postfix (Ubuntu)
Once connected, issue the following commands:
HELO localhost
This should return:
250 mail.hostname.com
Then enter:
MAIL FROM: username@domain.com
(replacing username@domain.com with whatever FROM address you want). You should see:
250 2.1.0 Ok
Next enter,
RCPT TO: username@domain.com
(again, replacing username@domain.com with whatever TO address you want). Again, you should see:
250 2.1.0 Ok.
Type in
DATA
and hit enter. You will see the following returned:
354 End data with ..
Type your message, when done, hit enter and type a single dot (period) on a line and hit enter. You should see:
250 2.0.0 Ok: queued as ###########
- where the # signs will be replaced with an alphanumeric identifier. You message has been queued to be sent.
That’s it. If you saw everything work you are good to go. Check your email and you should see your relayed message (make sure your firewall will permit port 25 outbound).
Now, configure Oracle.
Login to Oracle – as the Oracle user:
rlwrap sqlplus / as sysdba
Run the following:
@$ORACLE_HOME/rdbms/admin/utlmail.sql
@$ORACLE_HOME/rdbms/admin/prvtmail.plb
Then set the SMTP Server information like the following:
alter system set smtp_out_server = ’192.168.1.10:25′ scope=both;
Where 192.168.1.10 is the SMTP server IP address.
That’s it. Now test it from Oracle.
Run the following command:
exec utl_mail.send(
sender => ‘myfromaddress@domain.com’,
recipients => ‘mytoaddress@domain.com’,
subject => ‘Testing UTL_MAIL Send FROM Oracle’,
message => ‘This is my test message.’);
That’s about it.
This is a blogless blog.
I want to see more blogging in your blog