1 2 3 Previous Next 30 Replies Latest reply: Jul 30, 2012 6:51 AM by Dude! RSS

    Oracle Linux -  SMTP relay configuration

      Operation System : Oracle Linux 5x
      Application: Oracle E-Business Suite Release 12 (12.1.3)

      We have developed the scripts to take the daily backup(s) of our oracle database and application files and the script(s) are working fine. And we setup a cron job in crontab to run the backup job at 1.30am.

      I want the backup log file to be emailed after the backup is done. Please let me know how to do this. What command needs to be used in the backup script to email the backup log file as an attachment.

      Thanks in advance

      Edited by: user13681259 on May 29, 2012 2:35 AM
        • 1. Re: Oracle Linux
          # uuencode -m ${path_to_logfile} log_file.txt|mailx -s "E-mail description" ${mail_recipients}

          should work...

          Edited by: 923297 on 05.04.2012 14:38

          Edited by: 923297 on 05.04.2012 14:40
          • 2. Re: Oracle Linux
            Mail systems will do inline conversion of text, but a unix text file as an attachment will not be computer platform compatible. You should convert line endings before encoding if you are going to send it to MS-Windows clients.

            First you need to install required software:

            yum install unix2dos sharutils

            Then convert, encode and send the file

            unix2dos backup.log
            cat backup.log | uuencode -m backup.log > backup.att
            cat backup.att | mailx -s "backup logfile" me@example.com
            • 3. Re: Oracle Linux
              Thanks and will check and update the thread. thank you
              • 4. Re: Oracle Linux
                mailx -s "Testing" me@example.com ---(Using my email id here)

                Im using the above commnad for testing the email facility. But it hangs there and nothing is coming out. If i kill the pross while pressing CTRL+C the below messages desplays.

                (Interrupt -- one more to kill letter)

                Do we need to open any port on OS level?

                Please help.
                • 5. Re: Oracle Linux
                  That's normal because it requires input. You can type Ctrl-d and it should prompt for CC, or use e.g.:
                  echo "text" | mailx -s "Testing" me@example.com
                  • 6. Re: Oracle Linux
                    echo "text" | mailx -s "Testing" me@example.com

                    Its going to next prompt and NOT received any email. Please help to troubleshoot the issue. Thanks
                    • 7. Re: Oracle Linux
                      Does it work sending a mail to itself, e.g. root@localhost?

                      If that works, but sending mail outside your machine does not work, then you need to configure a mail smtp gateway or "smart host". It is not possible to help you without knowing your network environment and mail relay setup requirements.
                      • 8. Re: Oracle Linux
                        HOw to check whether root received this email : root@localhost, as there is no echo message on termial about mail.

                        could you please advice what needs to be configured to sending mail outside of the machine.

                        FYI: oracle application is running on this machine and workflow notification mailer configured and it is working sending the notification maile outside.
                        • 9. Re: Oracle Linux
                          In case you are using sendmail, I suggest to check the content of /var/log/maillog for any clues.
                          • 10. Re: Oracle Linux

                            May 25 16:50:16 ora-stg sendmail[26587]: q4O4fYCO011184: to=<me@example.com>, ctladdr=<orauat@ora-stg.local.com> (510/500), delay=1+04:08:42, xdelay=00:00:00, mailer=esmtp, pri=2640391, relay=example.com.s5b2.psmtp.com., dsn=4.0.0, stat=Deferred: Connection timed out with exmaple.com.s5b2.psmtp.com.

                            FYI: me@example.com -- used actual email address

                            root account mail:

                            May 22 04:02:01 ora-stg sendmail[12459]: q4LK21mW012459: to=root, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=31270, relay=[] [], dsn=2.0.0, stat=Sent (q4LK21VL012461 Message accepted for delivery)

                            Do we need to open any port or configure the relay? Please hlep
                            • 11. Re: Oracle Linux
                              Connection timed out with exmaple.com.s5b2.psmtp.com
                              Here seems to be your problem. Apart from "exmaple" probably being a typing mistake, I doubt that "example.com.s5b2.psmtp.com" is a valid smtp gateway.

                              I suggest to check your /etc/hosts file

                              and verify your sendmail configuration. What is the output of:
                              grep SMART /etc/mail/sendmail.mc
                              • 12. Re: Oracle Linux
                                We have verified at /etc/hosts file and the entries of our SMTP are correct

                                relay=example.com.s5b2.psmtp.com -- why rekat address is forming this way and i think it should format like below:
                                relay=[] []

                                Please help

                                • 13. Re: Oracle Linux
                                  If you send to root@localhost the mailer will use the local host to deliver the mail. If you send to me@example.com and example.com com is not the domain name of your local machine, then the mailer will need to resolve the IP address of the mail server of example.com by using the mail exchange record (MX) from DNS. A relay SMTP gateway, when configured, will be used to process your email if you send email outside your server's own mail domain. It is usually required if your server cannot or is not supposed to send emails directly.

                                  What is your output of the following commands:

                                  grep SMART /etc/mail/sendmail.mc
                                  grep LOCAL_DOMAIN /etc/mail/sendmail.mc

                                  You might want to give this thread are more meaningful subject than "Oracle Linux", like "SMTP relay configuration".
                                  • 14. Re: Oracle Linux
                                    [root@nfs-stg-db1 ~]# cat /etc/hosts
                                    # Do not remove the following line, or various programs
                                    # that require network functionality will fail.
                           localhost.localdomain localhost
                           nfs-stg-db1.rp.edu.sg nfs-stg-db1
                           nfs-stg-app1.rp.edu.sg nfs-stg-app1

                                    # nfs-stg-db1.rp.edu.sg nfs-stg-db1 localhost.localdomain localhost
                                    #::1 localhost6.localdomain6 localhost6
                                    # ppssftps1
                                    [root@nfs-stg-db1 ~]#

                                    # grep SMART /etc/mail/sendmail.mc
                                    dnl define(`SMART_HOST', `smtp.your.provider')dnl

                                    # grep LOCAL_DOMAIN /etc/mail/sendmail.mc

                                    May 29 17:35:47 nfs-stg-db1 sendmail[12203]: q4T9ZlJc012203: from=root, size=84, class=0, nrcpts=1, msgid=<201205290935.q4T9ZlJc012203@nfs-stg-db1.rp.edu.sg>, relay=root@localhost
                                    May 29 17:35:48 nfs-stg-db1 sendmail[12204]: q4T9Zlvw012204: from=<root@nfs-stg-db1.rp.edu.sg>, size=384, class=0, nrcpts=1, msgid=<201205290935.q4T9ZlJc012203@nfs-stg-db1.rp.edu.sg>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain []
                                    May 29 17:35:48 nfs-stg-db1 sendmail[12203]: q4T9ZlJc012203: to=ttan@deloitte.com, ctladdr=root (0/0), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30084, relay=[] [], dsn=2.0.0, stat=Sent (q4T9Zlvw012204 Message accepted for delivery)

                                    -- according to the log message status the email was sent, but we have not recevied any emails...

                                    Please help

                                    Edited by: user13681259 on May 29, 2012 2:39 AM
                                    1 2 3 Previous Next