Pivotal DCAv1 and DCAv2.
In this article we will take a look on how to send emails from scripts?
-- 1. Contact your account manager and submit an RPQ (Request for Product Qualification) to use mailx / sendmail on your DCA.
-- 2. Once the RPQ is approved, install any RPM packages required to get both mailx and sendmail on the system. You need these packages and any pre-requisites:
Package files can be found in /opt/rhel/55/CD1/Server.
-- 3. Next, update the configuration. In this example we update it on the master host mdw.
3.1 Look for this line in sendmail configuration: dnl define(`SMART_HOST', `smtp.your.provider')dnl
[root@mdw ~]# vi /etc/mail/sendmail.mc
Uncomment it by removing the "dnl" strings and replace with your SMTP host, for example:
Then add a line for the external domain name of your host
3.2 Edit or add that host name to /etc/hosts. For example, if you have:
That should become:
22.214.171.124 mdw-ext yourmaster-extname.example.com
3.3 Then rebuild the configuration
[root@mdw ~]# make -C /etc/mail
make: Entering directory `/etc/mail'
make: Leaving directory `/etc/mail'
3.4 Make sure sendmail is started
[root@mdw ~]# chkconfig sendmail on
[root@mdw ~]# service sendmail start
Starting sendmail: [ OK ]
Starting sm-client: [ OK ]
-- 4. Test mailx to send emails
cat email.txt | mailx -s "Subject line" email@example.com