Setting Up Mailman For External Email

From VistApedia
Revision as of 10:24, 18 May 2011 by Shabiel (talk | contribs)
Jump to: navigation, search

Sending

Most people want to send email to the outside world from VISTA. So we will start with that.

First you need to set-up an Email Server that accepts unauthenticated email via SMTP and relays it to the outside world. If you have an old style smtp relay server from your ISP, that will suffice. If you, like me,

Receiving

While you can expose your VISTA system to the outside world, it is better to have email go through your own mail server and then be relayed to VISTA. Either way, the VISTA set-up is the same.

I have a domain name that is linked to my ip address through dynamic DNS. So I opened port 25 on my router and had it forwarded to the machine hosting VISTA on port 25 on the machine. So if I send email to my domain from Gmail, it reaches VISTA.

Set-up a xinetd listener to forward requests on port 25 (or another port, if you are forwarding email to VISTA from a mail server) to a script that sets up GT.M and calls GTMLNX^XMRUCX.

sudo cat vista_pocn-moh_mm_port25
service vista-mm
        {
        disable = no
        port = 25
        socket_type = stream
        protocol = tcp
        user = sam
        server = /bin/bash
        groups = yes
        server_args = /home/sam/pocn-moh/mm_rpcproc
        type = UNLISTED
        wait = no
        }
sam@sam-desktop:~/pocn-moh$ cat mm_rpcproc
#!/bin/bash
#
cd /home/sam/pocn-moh
export gtm_dist=/opt/fis-gtm/V5.4-002A/utf8/
export gtmroutines="uo(routines) $gtm_dist"
export gtmgbldir=mumps.gld
export PATH=$PATH:$gtm_dist
export gtm_chset=utf-8
export gtm_icu_version=4.2
export gtm_badchar=0
date>>rpc_log.log
$gtm_dist/mumps -run GTMLNX^XMRUCX 2>> rpc_log.log
exit 0

Stop xinetd and start it in debug mode:

sam@sam-desktop:/etc/xinetd.d$ sudo service xinetd stop
 * Stopping internet superserver xinetd                                  [ OK ]
sam@sam-desktop:/etc/xinetd.d$ sudo xinetd -d

Make sure you see this line to indicate that your service started.

11/5/18@13:06:29: DEBUG: 6623 {cnf_start_services} Started service: vista-mm

Check netstat -tnlp to see that your port is open.

sam@sam-desktop:~$ netstat -tnlp
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:9200            0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:9201            0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:9270            0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:8001            0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:9250            0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:10025           0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:9260            0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:9100            0.0.0.0:*               LISTEN      -
tcp6       0      0 :::80                   :::*                    LISTEN      -
tcp6       0      0 :::22                   :::*                    LISTEN      -
tcp6       0      0 ::1:631                 :::*                    LISTEN      -
tcp6       0      0 :::443                  :::*                    LISTEN      -
tcp6       0      0 :::5900                 :::*                    LISTEN      1472/vino-server

Now, to actually send an email message. First, find a real email address in VISTA. I do that by going to my Mailman account on VISTA and see what my address is.

Good afternoon STAR
     You last signed on yesterday at 16:22


   PSM    Pharmacy Data Management ...
   PCE    PCE Coordinator Menu ...
   HS     Health Summary Coordinator's Menu ...
   VFM    VOE Fileman ...
   ADM    Admission Clerk Menu ...
   CAC    CPRS Configuration (Clin Coord) ...
   CLIN   Clinic Clerk Menu ...
   CRM    Reminder Managers Menu ...
   OP     Outpatient Pharmacy Manager ...
   PIMS   PHH - PIMS Main Menu ...
   TIUI   TIU Maintenance Menu ...
   TIUM   Text Integration Utilities (MIS Manager) ...
   WARD   Ward Clerk Menu ...
          Medication Administration Menu Pharmacy ...
          Physician Menu ...
          Rad/Nuc Med Total System Menu ...

Select Core Applications Option: MM  MailMan Menu

VA MailMan 8.0 service for HABIEL.SAM_M@MOH.AMMAN.JO
You last used MailMan: 05/17/11@16:22
You have no new messages.


   NML    New Messages and Responses
   RML    Read/Manage Messages
   SML    Send a Message
          Query/Search for Messages
   AML    Become a Surrogate (SHARED,MAIL or Other)
          Personal Preferences ...
          Other MailMan Functions ...
          Help (User/Group Info., etc.) ...

Select MailMan Menu Option:

So my email address is HABIEL.SAM_M@MOH.AMMAN.JO. Nice. Let's see if I can send myself an email.

sam@sam-desktop:~/pocn-moh$ telnet localhost 25
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 MOH.AMMAN.JO MailMan 8.0 ready
HELO SAM.EXAMPLE.COM
250 OK MOH.AMMAN.JO [8.0,DUP,SER,FTP]
MAIL FROM:<sam.habiel@example.com>
250 OK Message-ID:1055@MOH.AMMAN.JO
RCPT TO:<HABIEL.SAM_M@MOH.AMMAN.JO>
250 'RCPT' accepted
DATA
354 Enter data
From: Outside Sam <sam.habiel@example.com>
To: VISTA Sam <HABIEL.SAM_M@MOH.AMMAN.JO>
Date: May 18 2011
Subject: Hello VISTA

Hello VISTA. This is an external message going to VISTA.
.
250 'data' accepted
QUIT
221 MOH.AMMAN.JO Service closing transmission channel
Connection closed by foreign host.

You should see this in xinetd:

11/5/18@13:17:27: DEBUG: 6623 {server_start} Starting service vista-mm
11/5/18@13:17:27: DEBUG: 6623 {main_loop} active_services = 7