Closed TopicStart new topicStart Poll

> reinjecting a message into the queue, how does one do this ?
NomadCF
Posted: Sep 8 2006, 04:18 PM
Quote Post


Wizard
*********

Group: Members
Posts: 428
Member No.: 434
Joined: 21-January 03



Heres the idea, I have a script that archives every message in and out (not spam or virus,etc). This file is copied directly from the spool dir fully intact (meaning with all the xmail headers in place). Now what I'm like to do is be able to re inject that copy back into the xmail spool.

I've tried just coping it into spool/temp (it just sat there)
I've tired copying it into spool/local (it errors out “invalid spool file”)

The closest thing I've got to work it by remove all the xmail headers from the copy expect the :
“MAIL FROM,RCPT TO,<<MAIL-DATA>>” hen the message is delivered but it logs a lot of errors about the message and the headers f.u.b.a.r.


So the question comes down to this how does one drop email into xmails queue for delivery ?


--------------------
-- Chris L. Franklin --
www.NomadCF.com

All my scripts are written for linux servers.
My XMail scripts
PMEmail PosterUsers WebsiteAOL
Top
hschneider
Posted: Sep 9 2006, 06:22 AM
Quote Post


No - I'm not an answering script ...
Group Icon

Group: Admin
Posts: 6631
Member No.: 195
Joined: 19-June 02



Inject a mail by placing a RFC-conform mail file into spool/local. Each line has to have DOS style line endings:

CODE

MAIL FROM: <...>\r\n
RCPT TO: <...>\r\n
\r\n
FROM: <...>\r\n
TO: <...>\r\n
SUBJECT: <...>\r\n
X-SOME-MORE-HEADER-FIELDS: ....\r\n
\r\n
\r\n
The mail's text body ...\r\n
\r\n


If you want to restore archived mails, it's wise to remove all RECEIVED headers, because this can cause looping mails.


--------------------
Bye,
Harald


-- Download XMail Queue Manager 1.46 NOW: XMail Server Tools
-- Cross platform remote queue management!
-- Message analyzing on the fly!
-- Builtin diagnostics knowledge base!
-- Manages multiple mail queues!

Sponsored by
CD-Produktion und DVD-Produktion and Homestaging Saarland - Immobilien schneller verkaufen in der Region Saarland, Rheinland-Pfalz und Luxembourg
PMEmail PosterUsers Website
Top
NomadCF
Posted: Sep 9 2006, 07:11 AM
Quote Post


Wizard
*********

Group: Members
Posts: 428
Member No.: 434
Joined: 21-January 03



Thanks for the help, But I found it's only 1 return between the "RCPT TO:" and the headers. putting 2 return between then fubars the message and the server things the header are part of the body. But thanks for pointing me in the right Direction !!!


--------------------
-- Chris L. Franklin --
www.NomadCF.com

All my scripts are written for linux servers.
My XMail scripts
PMEmail PosterUsers WebsiteAOL
Top
hschneider
Posted: Sep 9 2006, 07:15 AM
Quote Post


No - I'm not an answering script ...
Group Icon

Group: Admin
Posts: 6631
Member No.: 195
Joined: 19-June 02



Yes - just went in to correct it, but you were faster :-)


--------------------
Bye,
Harald


-- Download XMail Queue Manager 1.46 NOW: XMail Server Tools
-- Cross platform remote queue management!
-- Message analyzing on the fly!
-- Builtin diagnostics knowledge base!
-- Manages multiple mail queues!

Sponsored by
CD-Produktion und DVD-Produktion and Homestaging Saarland - Immobilien schneller verkaufen in der Region Saarland, Rheinland-Pfalz und Luxembourg
PMEmail PosterUsers Website
Top
hschneider
Posted: Sep 9 2006, 07:18 AM
Quote Post


No - I'm not an answering script ...
Group Icon

Group: Admin
Posts: 6631
Member No.: 195
Joined: 19-June 02



One more thing:
If you are on Windows, using Perl, then you'll have to set the file's mode to binary before writing it:

CODE

open(FILE,'> '.$MAIL_ROOT.'/spool/local/'.time().rand(1000).'.txt') or &quit();
binmode(FILE);
print FILE $mail;
close(FILE);


Using the same code on other platforms doesn't matter.


--------------------
Bye,
Harald


-- Download XMail Queue Manager 1.46 NOW: XMail Server Tools
-- Cross platform remote queue management!
-- Message analyzing on the fly!
-- Builtin diagnostics knowledge base!
-- Manages multiple mail queues!

Sponsored by
CD-Produktion und DVD-Produktion and Homestaging Saarland - Immobilien schneller verkaufen in der Region Saarland, Rheinland-Pfalz und Luxembourg
PMEmail PosterUsers Website
Top
NomadCF
Posted: Sep 9 2006, 07:30 AM
Quote Post


Wizard
*********

Group: Members
Posts: 428
Member No.: 434
Joined: 21-January 03



you'll probably not want to just use time & a ramdom number, but also include the scripts PID (on windows this is not easy but there is a gpl program to help with this : http://www.scheibli.com/v3/projects/getpids/).

But this to is not 100% safe due to windows liking to reuse PID's rather quickly.

I hope this doesn't come across as a being picky.


--------------------
-- Chris L. Franklin --
www.NomadCF.com

All my scripts are written for linux servers.
My XMail scripts
PMEmail PosterUsers WebsiteAOL
Top
hschneider
Posted: Sep 9 2006, 07:45 AM
Quote Post


No - I'm not an answering script ...
Group Icon

Group: Admin
Posts: 6631
Member No.: 195
Joined: 19-June 02



Good point, let's doit with time+random+pid wink.gif


--------------------
Bye,
Harald


-- Download XMail Queue Manager 1.46 NOW: XMail Server Tools
-- Cross platform remote queue management!
-- Message analyzing on the fly!
-- Builtin diagnostics knowledge base!
-- Manages multiple mail queues!

Sponsored by
CD-Produktion und DVD-Produktion and Homestaging Saarland - Immobilien schneller verkaufen in der Region Saarland, Rheinland-Pfalz und Luxembourg
PMEmail PosterUsers Website
Top
hschneider
Posted: Sep 9 2006, 07:48 AM
Quote Post


No - I'm not an answering script ...
Group Icon

Group: Admin
Posts: 6631
Member No.: 195
Joined: 19-June 02



Just noticed, that the getpid thing is an .exe file. This will cause an overhead because a shell process is started . This will slow things down, eating up resources. However, it's a brilliant idea to use it on other platforms ...


--------------------
Bye,
Harald


-- Download XMail Queue Manager 1.46 NOW: XMail Server Tools
-- Cross platform remote queue management!
-- Message analyzing on the fly!
-- Builtin diagnostics knowledge base!
-- Manages multiple mail queues!

Sponsored by
CD-Produktion und DVD-Produktion and Homestaging Saarland - Immobilien schneller verkaufen in der Region Saarland, Rheinland-Pfalz und Luxembourg
PMEmail PosterUsers Website
Top
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
« Next Oldest | Documentation and Knowledge Base | Next Newest »

Closed TopicStart new topicStart Poll