At 12:50 2/21/2002 +0000, Nat B. wrote:
>is there a way to schedule a time to send a message to a mailing list?
>Is there a parameter that should be inserted in the mail header, and 
>treated by sendmail or majordomo in order to delay the message to a 
>certain time or date?
>
>I need the client to set the time for delivery, and send the message to 
>the server which will send the message on chosen date to a mailing list.
>Hope someone can put me on the right track.

That feature is not supported by SMTP, which means that no standard mail 
server can do it. The simplest solution is to use something like 'at' to 
send the message at the desired time. I looked at winfiles.com and found 
SMTPSend:

   
<http://download.cnet.com/downloads/0-3356720-100-5181220.html?tag=st.dl.10001-103-2.lst-7-3.5181220>

It's a shareware Windows utility that can send email on command. If the 
Windows system you're using has a system scheduler, you can set it to use 
SMTPSend to send the message at the desired time.


Alternatively, you could have a procmail recipe feed the message to a Perl 
script:

:0
* ^X-SendTime:
* ^From:.*specialuser@domain
* ^To:.*mailinglist@domain
| /usr/local/bin/perlscript.pl

The Perl script would have to parse out the X-SendTime header, put the rest 
of the message into a file, then use the 'at' command to schedule the 
message release.

#!/usr/bin/perl
#
# Take an RFC822 email message on STDIN and
# schedule it for later transmission.
#
# Copyright (c) Anthony E. Greene <[EMAIL PROTECTED]>
# License: GNU GPL v2 <http://www.gnu.org/licenses/gpl.txt>

# Generate the temp file name using the script name and process ID.
$scriptname = `basename $0`;
chomp($scriptname);
$tempfile = "/tmp/$scriptname.$$";

# Open the temp file for output (or die trying).
open(TEMP,">$tempfile") || die "Cannot open tempfile $tempfile";

# Read input
while ($line = <STDIN>) {
   # Only look at the header. First blank line is end of header.
   while (length($line) > 1) {
     if ($line =~ /^X-SendTime: /) {
       $sendtime = substr($line,12);
       chomp($sendtime);
       # Substitute a bogus line to obscure the X-Sendtime header.
       $line = "X-ScheduledMessage: TRUE\n";
     }
     print TEMP "$line";
   }
   print TEMP "$line";
}
close(TEMP);

# Schedule the job.
system("echo '/usr/bin/sendmail -oi -t < $tempfile' | at '$sendtime'");

exit;



This solution allows anyone who knows the proper address and header fields 
to send the message.

I wrote this just now and have not tested it. If you decide to use it, I'd 
be interested in any changes you needed to make to get it to work.


Tony
-- 
Anthony E. Greene <[EMAIL PROTECTED]>
PGP Key: 0x6C94239D
AOL/Yahoo Chat: TonyG05
Linux. the choice of a GNU generation. <http://www.linux.org/>



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to