Index: ccr/trunk/p/C0CMIME.m
===================================================================
--- ccr/trunk/p/C0CMIME.m	(revision 1191)
+++ ccr/trunk/p/C0CMIME.m	(revision 1204)
@@ -1,3 +1,3 @@
-C0CMIME ; CCDCCR/GPL - MIME manipulation utilities; 3/8/11
+C0CMIME ; CCDCCR/GPL - MIME manipulation utilities; 3/8/11 ; 5/16/11 2:32pm
  ;;1.0;C0C;;Mar 8, 2011;
  ;Copyright 2008 George Lilly.  Licensed under the terms of the GNU
@@ -81,11 +81,16 @@
  S C0CGM(4)="It is purely test data used for software development"
  S C0CGM(5)="It does not represent information about any person living or dead"
- S ZTO("glilly@glilly.net")=""
- S ZTO("LILLY.GEORGE@mdc-crew.net")=""
+ ;S ZTO("glilly@glilly.net")=""
+ ;S ZTO("george.lilly@pobox.com")=""
+ ;S ZTO("george@nhin.openforum.opensourcevista.net")=""
+ ;S ZTO("mish@nhin.openforum.opensourcevista.net")="" 
+ S ZTO("brooks.richard@securemail.opensourcevista.net")="" 
+ ;S ZTO("LILLY.GEORGE@mdc-crew.net")=""
  ;S ZTO("ncoal@live.com")=""
  ;S ZTO("martijn@djigzo.com")=""
  ;S ZTO("profmish@gmail.com")=""
  ;S ZTO("nanthracite@earthlink.net")=""
- S ZFROM="ANTHRACITE.NANCY"
+ S ZTO("gpl.doctortest@gmail.com")=""
+ S ZFROM="LILLY.GEORGE"
  S ZATTACH=$NA(^GPL("CCR"))
  I $G(@ZATTACH@(1))="" D  ; NO CCR THERE
@@ -93,9 +98,30 @@
  . M @ZATTACH=GPL ; PUT IT IN THERE FOR NEXT TIME
  S ZSUBJECT="TEST OF THE NEW MAILSEND ROUTINE"
- D MAILSEND(.GR,ZFROM,"ZTO",,ZSUBJECT,"C0CGM",ZATTACH)
+ D MAILSEND(.GR,ZFROM,"ZTO",,ZSUBJECT,"C0CGM",ZATTACH,"CCR.xml")
  ZWR GR
  Q
  ;
-MAILSEND(RTN,FROM,TO,CC,SUBJECT,MESSAGE,ATTACH,FLAGS) ; MAIL SENDING INTERFACE
+LINE(C0CFILE,C0CTO) ; read a file name passed in C0CFILE and send it to
+ ; the email address in C0CTO 
+ ; the directory and the "from" are all hard coded
+ ;
+ N ZZFROM S ZZFROM="LILLY.GEORGE"
+ N GN S GN=$NA(^TMP("C0CMIME2",$J))
+ N GN1 S GN1=$NA(@GN@(1))
+ K @GN
+ I '$D(C0CFILE) Q  ; NO FILENAME PASSED
+ I '$D(C0CTO) S C0CTO="brooks.richard@securemail.opensourcevista.net"
+ S ZZTO(C0CTO)=""
+ N ZMESS S ZMESS(1)="file transmission from wvehr3-09"
+ N GD S GD="/home/wvehr3-09/EHR/" ; directory
+ I '$$FTG^%ZISH(GD,C0CFILE,GN1,3) Q  D  ;
+ . W !,"error reading file",C0CFILE
+ D MAILSEND(.ZRTN,ZZFROM,"ZZTO",,"file transmission","ZMESS",GN,C0CFILE)
+ K @GN ; CLEAN UP
+ ;ZWR ZRTN
+ W !,$G(ZRTN(1))
+ Q
+ ;
+MAILSEND(RTN,FROM,TO,CC,SUBJECT,MESSAGE,ATTACH,FNAME,FLAGS) ; MAIL SENDING INTERFACE
  ; RTN IS THE RETURN ARRAY PASSED BY REFERENCE
  ; FROM IS PASSED BY VALUE AND IS THE EMAIL ADDRESS OF THE SENDER
@@ -107,5 +133,7 @@
  ; MESSAGE IS PASSED BY NAME AND IS AN ARRAY OF TEXT
  ; ATTACH IS PASSED BY NAME AND IS AN XML OR HTML FILE TO BE ATTACHED
- ;
+ ; FNAME IS THE FILENAME OF THE ATTACHMENT, DEFAULT IS ccr.xml
+ ;
+ I '$D(FNAME) S FNAME="ccr.xml" ; default filename
  N GN
  S GN=$NA(^TMP($J,"C0CMIME"))
@@ -113,22 +141,22 @@
  S GM(1)="MIME-Version: 1.0"
  S GM(2)="Content-Type: multipart/mixed; boudary=""1234567"""
- S GM(3)=" "
- S GM(4)=" "
+ S GM(3)=""
+ S GM(4)=""
  ;S GM(5)="--123456788888"
  ;S GM(5)=$$REPEAT^XLFSTR("-",$L(X))
  S GM(5)="--123456899999"
- S GM(6)="Content-Type: text/xml; name=""ccr.xml"""
+ S GM(6)="Content-Type: text/xml; name="_FNAME
  S GM(7)="Content-Transfer-Encoding: base64"
- S GM(8)="Content-Disposition: attachment; filename=""ccr.xml"""
- S GM(9)=" "
- S GM(10)=" " ; FOR THE END
+ S GM(8)="Content-Disposition: attachment; filename="_FNAME
+ S GM(9)=""
+ S GM(10)="" ; FOR THE END
  ;S GM(11)="--123456788888--"
  S GM(11)="--123456899999--"
- S GM(12)=" "
- S GM(13)=" "
+ S GM(12)=""
+ S GM(13)=""
  S GG(1)="--123456899999"
  S GG(2)="Content-Type: text/plain; charset=ISO-8859-1; format=flowed"
  S GG(3)="Content-Transfer-Encoding: 7bit"
- S GG(4)=" "
+ S GG(4)=""
  S GG(5)="This is a test message."
  S GG(6)="A Continuity of Care record is attached"
@@ -136,8 +164,8 @@
  S GG(8)="It is purely test data used for software development"
  S GG(9)="It does not represent information about any person living or dead"
- S GG(10)=" "
+ S GG(10)=""
  S GG(11)="--123456899999--"
  ;S GG(11)="Content-Type: text/plain; charset=""us-ascii"""
- S GG(12)=" "
+ S GG(12)=""
  ;S GG(13)="This is a test message."
  S GG(14)="A Continuity of Care record is attached"
@@ -145,5 +173,5 @@
  S GG(16)="It is purely test data used for software development"
  S GG(17)="It does not represent information about any person living or dead"
- S GG(18)=" "
+ S GG(18)=""
  S GG(19)="--123456899999"
  S GG(20)="--987654321--"
@@ -183,6 +211,6 @@
  S GM(1)="MIME-Version: 1.0"
  S GM(2)="Content-Type: multipart/mixed; boudary=""1234567"""
- S GM(3)=" "
- S GM(4)=" "
+ S GM(3)=""
+ S GM(4)=""
  S GM(5)="--1234567"
  ;S GM(5)=$$REPEAT^XLFSTR("-",$L(X))
@@ -191,9 +219,9 @@
  S GM(8)="Content-Disposition: attachment; filename=""ccr.xml"""
  ;S GM(6)=$$UUBEGFN^LRSRVR2A("CCR.xml")
- S GM(9)=" "
- S GM(10)=" " ; FOR THE END
+ S GM(9)=""
+ S GM(10)="" ; FOR THE END
  S GM(11)="--frontier--"
  S GM(12)="."
- S GM(13)=" "
+ S GM(13)=""
  K GBLD
  ;D QUEUE^C0CXPATH("GBLD","GM",1,9)
@@ -232,6 +260,6 @@
  S GM(1)="MIME-Version: 1.0"
  S GM(2)="Content-Type: multipart/mixed; boudary=""1234567"""
- S GM(3)=" "
- S GM(4)=" "
+ S GM(3)=""
+ S GM(4)=""
  S GM(5)="--1234567"
  ;S GM(5)=$$REPEAT^XLFSTR("-",$L(X))
@@ -240,9 +268,9 @@
  S GM(8)="Content-Disposition: attachment; filename=""ccr.xml"""
  ;S GM(6)=$$UUBEGFN^LRSRVR2A("CCR.xml")
- S GM(9)=" "
- S GM(10)=" " ; FOR THE END
+ S GM(9)=""
+ S GM(10)="" ; FOR THE END
  S GM(11)="--1234567--"
- S GM(12)=" "
- S GM(13)=" "
+ S GM(12)=""
+ S GM(13)=""
  K GBLD
  D QUEUE^C0CXPATH("GBLD","GM",5,9)
