Article View: news.software.readers
Article #72570Re: about Xnews, also question about email clients.
From: Thomas LEMOINE
Date: Fri, 23 Feb 2001 01:24
Date: Fri, 23 Feb 2001 01:24
115 lines
5559 bytes
5559 bytes
Paul Batchie <paulobTakeOut@myrealbox.com> writes:
> Just wondered because the way you described Hamster's script power
> suggested to me that KorrNews was in the loop. Now I wonder how you
> can do all that _without_ KN!
Argh. Just mailed it to someone who asked me in private. Ok, I'll
copypaste it.
1) Put in Xnews custom X-To, X-Cc and/or X-Bcc headers. Their values
should be bare a@b.com addresses, without names, comments or even angle
brackets, one address per field. If multiple recipients, use multiple
headers (it is perfectly legal and will work). (It might be possible to
do better, but I'm too lazy to work it out.)
2) Write something like this in a SendMails.hsc script file:
-=-=-=-=-
#!hs2
#!load BStrings.hsm
#!load BMsgHeader.hsm
# NB: both these modules are part of Hamster-Fr distribution,
# so ymmv if you use Hamster-Classic
AddRecips
HamSendMail( "your.smtp.server" )
# you may add other commands here,
# for instance to post news, get news, get mails, hangup connection, etc
Quit
Sub AddRecips
Var( $i, $msg, $MsgContent, $nb_msg, $to, $extrato, $MsgFile_i , $mid, $subject )
# Get the names of outgoing mail files in Mail.out dir
$msg = ListAlloc
$nb_msg = ListFiles( $msg, HamPath + "Mails\Mail.Out\*.msg", 1 ) - 1
$MsgContent = ListAlloc
For( $i, 0, $nb_msg, 1 )
# Get a file name "$i.msg"
$MsgFile_i = ListGet( $msg, $i )
print( $MsgFile_i )
# Empty $MsgContent list, then puts "$MsgFile_i" file contents in it
ListClear( $MsgContent )
ListLoad( $MsgContent, $MsgFile_i )
# Header treatment
# X-To
Label( xto )
# Gets the 1st X-To it finds
$extrato = MsgGetHeader( $MsgContent, "X-To:" )
If( $extrato != "" )
# Puts the RCPT in 2nd position, i.e. just below the MAIL FROM
ListInsert( $MsgContent, 2, "!RCPT TO: " + $extrato )
$to = MsgGetHeader( $MsgContent, "To:" )
If( $to = "" )
MsgAddHeader( $MsgContent, "To:", $extrato )
Else
MsgChangeHeader( $MsgContent, "To:", $to + ", " + $extrato )
EndIf
MsgDelHeader( $MsgContent, "X-To:" )
# Tries again until it finds no more
Goto( xto )
EndIf
# X-Cc
Label( xcc )
# Gets the 1st X-Cc it finds
$extrato = MsgGetHeader( $MsgContent, "X-Cc:" )
If( $extrato != "" )
# Puts the RCPT in 2nd position, i.e. just below the MAIL FROM
ListInsert( $MsgContent, 2, "!RCPT TO: " + $extrato )
$to = MsgGetHeader( $MsgContent, "Cc:" )
If( $to = "" )
MsgAddHeader( $MsgContent, "Cc:", $extrato )
Else
MsgChangeHeader( $MsgContent, "Cc:", $to + ", " + $extrato )
EndIf
MsgDelHeader( $MsgContent, "X-Cc:" )
# Tries again until it finds no more
Goto( xcc )
EndIf
# X-Bcc
Label( xbcc )
# Gets the 1st X-Bcc it finds
$extrato = MsgGetHeader( $MsgContent, "X-Bcc:" )
If( $extrato != "" )
# Puts the RCPT in 2nd position, i.e. just below the MAIL FROM
ListInsert( $MsgContent, 2, "!RCPT TO: " + $extrato )
MsgDelHeader( $MsgContent, "X-Bcc:" )
# Tries again until it finds no more
Goto( xbcc )
EndIf
# Returns content of list $MsgContent in file "$i.msg"
ListSave( $MsgContent, $MsgFile_i )
EndFor
EndSub
-=-=-=-=-
3) Now you will send your mails with this script instead of selecting
the server in the Servers menu.
I think it's error-free, but no warranty -- it's not easy at 2:15am. I
hope I won't fall asleep tomorrow (er, today) at work...
--
Thomas Lemoine
Technical Details
Message-ID:
<wk66i2ur92.fsf@solaris.wkaz.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!supernews.google.com!sn-xit-03!supernews.com!freenix!fr.usenet-edu.net!usenet-edu.net!fr.clara.net!heighliner.fr.clara.net!grolier!proxad.net!feeder2.proxad.net!nnrp2.proxad.net.POSTED!not-for-mailReferences:
<Xns904CF372659D2simple@216.166.62.35> <ahp19tse7jbdc23c3nhp9b80nub81t5k5c@4ax.com> <Xns904D79D88D64D.thomas@esperanza.wkaz.net> <8i929to2s8g9c0ump3dkbkh5p3q0i8b2s9@4ax.com> <Xns904FCEAF21E7Cxjahn@24.129.0.130> <wkitm3p4m8.fsf@solaris.wkaz.net> <Xns90504DECC6A86crinkles@136.182.15.25> <upuga3f72.fsf@esperanza.wkaz.net> <t5ha9tg54a3v30fgl2vdeec40h72ingpfa@4ax.com> <wkhf1midno.fsf@solaris.wkaz.net> <agcb9tgpalk0bts270vibvddqsl20sfvh8@4ax.com>Show Full Headers
Complete Article Headers
Message-ID: <wk66i2ur92.fsf@solaris.wkaz.net> Subject: Re: about Xnews, also question about email clients. Date: Fri, 23 Feb 2001 01:24:55 GMT From: Thomas LEMOINE <thomas@wkaz.net> References: <Xns904CF372659D2simple@216.166.62.35> <ahp19tse7jbdc23c3nhp9b80nub81t5k5c@4ax.com> <Xns904D79D88D64D.thomas@esperanza.wkaz.net> <8i929to2s8g9c0ump3dkbkh5p3q0i8b2s9@4ax.com> <Xns904FCEAF21E7Cxjahn@24.129.0.130> <wkitm3p4m8.fsf@solaris.wkaz.net> <Xns90504DECC6A86crinkles@136.182.15.25> <upuga3f72.fsf@esperanza.wkaz.net> <t5ha9tg54a3v30fgl2vdeec40h72ingpfa@4ax.com> <wkhf1midno.fsf@solaris.wkaz.net> <agcb9tgpalk0bts270vibvddqsl20sfvh8@4ax.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!supernews.google.com!sn-xit-03!supernews.com!freenix!fr.usenet-edu.net!usenet-edu.net!fr.clara.net!heighliner.fr.clara.net!grolier!proxad.net!feeder2.proxad.net!nnrp2.proxad.net.POSTED!not-for-mail User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 Hamster-Fr/1.7.8.1 Newsgroups: news.software.readers Distribution: global Mail-Copies-To: never X-No-Productlinks: yes X-Bounce: Content-Type != text/plain X-Binaries-To: binaries@wkaz.net Organization: Children of the sun Lines: 114 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: 213.36.6.10 X-Complaints-To: abuse@proxad.net X-Trace: nnrp2.proxad.net 982891495 213.36.6.10 (Fri, 23 Feb 2001 02:24:55 CET) NNTP-Posting-Date: Fri, 23 Feb 2001 02:24:55 CET