> Hi there,
>
> I have mercury running on my local webserver. Now I want to configure
> mercury that it sends all the emails received to another smtp server
> in my network (e.g. smtp.mydomain.org). Mercury should not make any mx
> lookups itself, only forward it.
Mercury/32 currently does not provide MX services. David's looking into this for a future enhancement but until that happens here's a work around.
1. Create a domain account for the domain you want forwarded. For example I forward the domain novell-tstephenson.com so I have a domains list setting of
DM=novell: novelltstephenson.com
2. Create a program to get the CNM files in the user NOVELL directory and convert them to 101 "glue" header queue files that change the address to the IP address of the receiving SMTP host. I did this in BASIC but you could use anything you happen to have and are familiar with to do the same thing.
REM This program was developed to send mail from a "domain" account to a different
REM server via SMTP. It takes the CNM RFC 2822 message body, extracts the SMTP addresses
REM and then saves it as a 101 file. The CNM import file is a directory listing
REM of the CNM files in the "domain" user account.
CLS
REM Set the path to the domain mailbox and the new domain name.
PATHSPEC$ = "c:\pmail\mail\novell\"
Domain$ = "@[192.168.1.3]"
REM Read in the CNM files
OPEN PATHSPEC$ + "files.txt" FOR INPUT AS #1
WHILE NOT EOF(1)
REM Read the CNM directory listing
LINE INPUT #1, Line$
REM Check to see if this is a CNM file else skip it. The CNM file is always 8.3.
IF RIGHT$(Line$, 3) = "CNM" THEN File$ = RIGHT$(Line$, 12) ELSE GOTO SKIP
REM Read the CNM file
OPEN PATHSPEC$ + File$ FOR INPUT AS #2
REM Get the MAIL FROM: and RCPT TO: addresses for the glue headers.
REM I'm using the Sender: for the MAIL FROM: address. It may be blank
REM for locally delivered mail but a blank MAIL FROM: works for me.
WHILE NOT EOF(2)
LINE INPUT #2, Line$
IF LEFT$(Line$, 14) = "X-Envelope-To:" THEN RCPTTO$ = MID$(Line$, 16, LEN(Line$))
IF LEFT$(Line$, 7) = "Sender:" THEN MAILFROM$ = MID$(Line$, 9, LEN(Line$))
WEND
REM Close the CNM file.
CLOSE #2
REM Change the domain name to the new domain in the RCPT TO: address.
FOR I = 1 TO 100
IF MID$(RCPTTO$, I, 1) = "@" THEN RCPT2$ = MID$(RCPTTO$, 1, I - 1) + Domain$
NEXT I
REM If the SMTP address was in brackets add the trailing bracket.
IF LEFT$(RCPT2$, 1) = "<" THEN RCPT2$ = RCPT2$ + ">"
REM Write the 101 file in Glue header format.
OPEN PATHSPEC$ + File$ FOR INPUT AS #2
OPEN PATHSPEC$ + LEFT$(File$, 8) + ".101" FOR OUTPUT AS #3
REM Write the MAIL FROM:, RCPT TO: and blank line.
PRINT #3, "$$ " + MAILFROM$
PRINT #3, RCPT2$
PRINT #3, ""
REM Write the rest of the RFC 2822 body to the 101 file.
WHILE NOT EOF(2)
LINE INPUT #2, Line$
PRINT #3, Line$
WEND
REM Close the CNM and 101 Files.
CLOSE 2
CLOSE 3
REM Delete the CNM file
KILL PATHSPEC$ + File$
SKIP:
WEND
CLOSE
SYSTEM
END
4. Create a BATCH file to process the CNM files. I got the program wait.com off the web someplace. Works fine.
ECHO OFF
:LOOP
CD c:\pmail\mail\novell
dir c:\pmail\mail\novell\*.cnm > c:\pmail\mail\novell\files.txt
REM CALL c:\qb45\qb /RUN c:\pmail\mail\novell\MX.BAS
call c:\pmail\mail\novell\mx.exe
move *.101 c:\mercury\queue
DEL c:\pmail\mail\novell\files.txt
call c:\pmail\mail\novell\wait -m 5
GOTO LOOP
5. Load the batch file at startup. I use NT Wrapper Pro to run it as a service at startup.
Now mail for domain novell-tstephenson.com is received by tstephenson.com and moved to the Novell user new mail directory. The bat file runs the program very 5 minutes and makes a list of all the CNM to files.txt. The BAS file is run and reads the files.txt file to get all of the CNM files and adds the "glue" headers to the original CNM file and saves it as a 101 file. The bat file moves the 101 files to the queue and loops.
This works for me to forward all mail from the outside world with the domain novell-tstephenson.com to the Mercury NLM server running on my Novell system.
&gt; Hi there,
&gt;
&gt; &nbsp;I have mercury running on my local webserver. Now I want to configure
&gt; mercury that it sends all the emails received to another smtp server
&gt; in my network (e.g. smtp.mydomain.org). Mercury should not make any mx
&gt; lookups itself, only forward it.
Mercury/32 currently does not provide MX services.&nbsp; David's looking into this for a future enhancement but until that happens here's a work around.&nbsp; &nbsp;
1.&nbsp;&nbsp; &nbsp;Create a domain account for the domain you want forwarded. For example I forward the domain novell-tstephenson.com so I have a domains list setting of
DM=novell: novelltstephenson.com
2.&nbsp;&nbsp; &nbsp;Create a program to get the CNM files in the user NOVELL directory and convert them to 101 "glue" header queue files that change the address to the IP address of the receiving SMTP host.&nbsp; I did this in BASIC but you could use anything you happen to have and are familiar with to do the same thing.
REM This program was developed to send mail from a "domain" account to a different
REM server via SMTP.&nbsp; It takes the CNM RFC 2822 message body, extracts the SMTP addresses
REM and then saves it as a 101 file.&nbsp; The CNM import file is a directory listing
REM of the CNM files in the "domain" user account.
CLS
REM Set the path to the domain mailbox and the new domain name.
PATHSPEC$ = "c:\pmail\mail\novell\"
Domain$ = "@[192.168.1.3]"
REM Read in the CNM files
OPEN PATHSPEC$ + "files.txt" FOR INPUT AS #1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
WHILE NOT EOF(1)
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;REM Read the CNM directory listing
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;LINE INPUT #1, Line$
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;REM Check to see if this is a CNM file else skip it.&nbsp; The CNM file is always 8.3.
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;IF RIGHT$(Line$, 3) = "CNM" THEN File$ = RIGHT$(Line$, 12) ELSE GOTO SKIP
&nbsp;&nbsp; &nbsp;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;REM Read the CNM file
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;OPEN PATHSPEC$ + File$ FOR INPUT AS #2
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;REM Get the MAIL FROM: and RCPT TO: addresses for the glue headers.
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;REM I'm using the Sender: for the MAIL FROM: address. It may be blank
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;REM for locally delivered mail but a blank MAIL FROM: works for me.
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;WHILE NOT EOF(2)
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;LINE INPUT #2, Line$
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;IF LEFT$(Line$, 14) = "X-Envelope-To:" THEN RCPTTO$ = MID$(Line$, 16, LEN(Line$))
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;IF LEFT$(Line$, 7) = "Sender:" THEN MAILFROM$ = MID$(Line$, 9, LEN(Line$))
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;WEND
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;REM Close the CNM file.
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;CLOSE #2
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;REM Change the domain name to the new domain in the RCPT TO: address.
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;FOR I = 1 TO 100
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;IF MID$(RCPTTO$, I, 1) = "@" THEN RCPT2$ = MID$(RCPTTO$, 1, I - 1) + Domain$
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;NEXT I
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;REM If the SMTP address was in brackets add the trailing bracket.
&nbsp;&nbsp; &nbsp;IF LEFT$(RCPT2$, 1) = "&lt;" THEN RCPT2$ = RCPT2$ + "&gt;"
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;REM Write the 101 file in Glue header format.
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;OPEN PATHSPEC$ + File$ FOR INPUT AS #2
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;OPEN PATHSPEC$ + LEFT$(File$, 8) + ".101" FOR OUTPUT AS #3
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;REM Write the MAIL FROM:, RCPT TO: and blank line.
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;PRINT #3, "$$ " + MAILFROM$
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;PRINT #3, RCPT2$
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;PRINT #3, ""
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;REM Write the rest of the RFC 2822 body to the 101 file.
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;WHILE NOT EOF(2)
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;LINE INPUT #2, Line$
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;PRINT #3, Line$
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;WEND
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;REM Close the CNM and 101 Files.&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;CLOSE 2
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;CLOSE 3
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;REM Delete the CNM file
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;KILL PATHSPEC$ + File$
SKIP:
WEND
CLOSE
SYSTEM
END
4.&nbsp;&nbsp; &nbsp;Create a BATCH file to process the CNM files.&nbsp; I got the program wait.com off the web someplace.&nbsp; Works fine.
ECHO OFF
:LOOP
CD c:\pmail\mail\novell
dir c:\pmail\mail\novell\*.cnm &gt; c:\pmail\mail\novell\files.txt
REM CALL c:\qb45\qb /RUN c:\pmail\mail\novell\MX.BAS
call c:\pmail\mail\novell\mx.exe
move *.101 c:\mercury\queue
DEL c:\pmail\mail\novell\files.txt
call c:\pmail\mail\novell\wait -m 5
GOTO LOOP
5.&nbsp;&nbsp; &nbsp;Load the batch file at startup.&nbsp; I use NT Wrapper Pro to run it as a service&nbsp; at startup.
Now mail for domain novell-tstephenson.com is received by tstephenson.com and moved to the Novell user new mail directory.&nbsp; The bat file runs the program very 5 minutes and makes a list of all the CNM to files.txt.&nbsp; The BAS file is run and reads the files.txt file to get all of the CNM files and adds the "glue" headers to the original CNM file and saves it as a 101 file.&nbsp; The bat file moves the 101 files to the queue and loops.
This works for me to forward all mail from the outside world with the domain novell-tstephenson.com to the Mercury NLM server running on my Novell system.&nbsp;