This is an old revision of the document!
For more secure sendmail in AIX 7.2 TL4
https://www.ibm.com/support/knowledgecenter/ssw_aix_72/s_commands/sendmail.dita
To setup sendmail, update the file sendmail.cf, and check that /etc/senmail.cf is a symbolic link. The file used by sendmail is /etc/mail/sendmail.cf
[root@nimsrv]/etc# ls -l /etc/sendmail.cf /etc/mail/sendmail.cf 56 -rw-r--r-- 1 root system 53277 Aug 16 12:07 /etc/mail/sendmail.cf 0 lrwxrwxrwx 1 root system 21 Jun 1 2012 /etc/sendmail.cf -> /etc/mail/sendmail.cf
Be care full each AIX update will reset the sendmail.cf file to default values.
Sendmail.cf configuration:
change the #Dj$w.Foo.COM by : Djsmtpserver.local.com change DS with your mail domain: DSmymail.com
... ################## # local info # ################## # my LDAP cluster # need to set this before any LDAP lookups are done (including classes) #D{sendmailMTACluster}$m Cwlocalhost # file containing names of hosts for which we receive email # Fw/etc/mail/local-host-names # my official domain name # ... define this only if sendmail cannot automatically determine your domain #Dj$w.Foo.COM # host/domain names ending with a token in class P are canonical CP. # UUCP relay host #DYrelayhostname #CPUUCP # "Smart" relay host (may be null) DS ....
http://www.deer-run.com/~hal/sysadmin/sendmail.html
If you wants to start sendmail service, use the following command. It can be activate at restart, by uncommented the sendmail line into /etc/rc.tcpip. Sendmail service is not needed to send email on AIX, it can just resend mails in case of trouble.
# startsrc -s sendmail -a "-bd -q30m"
The reality, however, is that the Sendmail daemon on a machine is only responsible for two things:
You can simply add an entry into /etc/syslog.conf, create the logfile and restart syslogd daemon
mail.debug /var/log/syslog/mail.log rotate size 500k files 4 compress
On AIX sendmail daemon is not required to send an email to a Exchange server. Sendmail daemon is used if the AIX server act as email server.
Sendmail config file is located in /etc/mail/sendmail.cf, /etc/sendmail.cf is just a symbolic link. It contain the sendmail server destination and if needed a default domain
[root@aix01] /var/spool/mail> grep DS /etc/sendmail.cf # COMPONENT_NAME: CMDSEND sendmail.cf DSsmtp-server.exchange.lu # Return-Receipt-To: header implies DSN request # DHParameters (only required if DSA/DH is used) # Smart-Host relay defined by "DS" macro. [root@aix01] /var/spool/mail> grep Dj /etc/sendmail.cf #Dj$w.Foo.COM
A email which is send to the server will be temporary stored to /var/spool/mqueue, and has a data file and a control file. If the mail is not send it stays in this folder. You can check pending mail, if the date is not known, check in the folder le files date using the commands:
[root@aix01] /var/spool/mqueue> mailq /var/spool/mqueue (2 requests) -----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient----------- s0968Jhr32571522 107 Thu Jan 9 07:08 apipnr (Deferred: Connection timed out with smtp-server.exchange.lu.) my.email@mydomain.lu q68100WD15597764 (no control file) Total requests: 2 [root@aix01] /var/spool/mqueue> ls -l total 16 4 drwxrwx--- 2 root system 4096 Sep 1 10:05 . 4 drwxrwxr-x 13 bin bin 4096 Nov 4 2010 .. 0 -rw------- 1 root system 0 Jul 8 2012 dfq68100WD15597764 4 -rw------- 1 root system 107 Jan 9 2014 dfs0968Jhr32571522 0 -rw------- 1 root system 0 Jul 8 2012 qfq68100WD15597764 4 -rw------- 1 root system 804 Jan 9 2014 qfs0968Jhr32571522 4 -rw------- 1 root system 609 Jun 28 2015 qft5SFd05T7864368 4 -rw------- 1 root system 609 Feb 11 2015 qfv1B4s1Dr7864368 4 -rw------- 1 root system 1 Jun 28 2015 dft5SFd05T7864368 4 -rw------- 1 root system 1 Feb 11 2015 dfv1B4s1Dr7864368
Here we can see other mail IDs, which are lost mail, better is to delete then. It can also come from a previous installation (clone using mksysb)!
You can try to resend queued mail, but first check the date, if too old better is to delete, but check with the destination. Try the following command:
[root@aix01] /var/spool/mqueue> sendmail -q
Test the communication with your mail server:
An easy way to test by using
stoprsc -s sendmail /usr/lib/sendmail -v -q30s -X /tmp/sendmail.debug
telnet mail.test.com 25
Trying... Connected to mail.test.com. Escape character is '^T'. 220 MAIL.test.com Microsoft ESMTP MAIL Service ready at Fri, 29 Apr 2011 17:17:48 +0200
ehlo test.com
250-mail.test.com Hello [10.10.10.5] 250-SIZE 104857600 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-AUTH 250-8BITMIME 250-BINARYMIME 250-CHUNKING 250 XEXCH50
ehlo test1.com
250-MAIL.test.com Hello [10.10.10.5] 250-SIZE 104857600 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-AUTH 250-8BITMIME 250-BINARYMIME 250-CHUNKING 250 XEXCH50
MAIL From:<labotest@test.com>
250 2.1.0 Sender OK
RCPT To:<test@yahoo.com>
250 2.1.5 Recipient OK
DATA
354 Start mail input; end with <CRLF>.<CRLF>
subject test labotest
.
250 2.6.0 <c94e6500-82ae-4c42-a9f5-6736f87344b1@MAIL.test.com> Queued mail for delivery
quit
221 2.0.0 Service closing transmission channel Connection closed.
v_mailpart="$(uuidgen)/$(hostname)" echo "To: my@email.com Subject: subject Content-Type: multipart/mixed; boundary=\"$v_mailpart\" MIME-Version: 1.0 This is a multi-part message in MIME format. --$v_mailpart Content-Type: text/html Content-Disposition: inline <html><body>Message text itself.</body></html> --$v_mailpart Content-Transfer-Encoding: base64 Content-Type: application/octet-stream; name=file_name.ext Content-Disposition: attachment; filename=file_name.ext `base64 /path/to/file` --$v_mailpart--" | /usr/sbin/sendmail -t
Change into the file /etc/sendmail.cf, the SMP servername mailrelayserver.domain.com, and the port 2525
... # “Smart” relay host (may be null) DSmailrelayserver.domain.com ... Msmtp, P=[IPC], F=mDFMuX, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP/HdrFromSMTP, E=\r\n, L=990, T=DNS/RFC822/SMTP, A=TCP $h 2525 Mesmtp, P=[IPC], F=mDFMuXa, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP/HdrFromSMTP, E=\r\n, L=990, T=DNS/RFC822/SMTP, A=TCP $h Msmtp8, P=[IPC], F=mDFMuX8, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP/HdrFromSMTP, E=\r\n, L=990, T=DNS/RFC822/SMTP, A=TCP $h Mdsmtp, P=[IPC], F=mDFMuXa%, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP/HdrFromSMTP, E=\r\n, L=990, T=DNS/RFC822/SMTP, A=TCP $h Mrelay, P=[IPC], F=mDFMuXa8, S=EnvFromSMTP/HdrFromSMTP, R=MasqSMTP/MasqRelay, E=\r\n, L=2040, T=DNS/RFC822/SMTP, A=TCP $h
# startsrc –s iptrace –a "-b 2000000000 –p 25,53 /tmp/iptrace.log" # echo "test" | mail –v "test email" email@test.com > /tmp/mail_test.log # stopsrc -s iptrace
If you use mail_files script, it allows you to trace all mails. AIX scripts