MarkB wrote:Oops. Sorry. Cut this bit:
Hello MarkB,
thankl you very much. I answer only today because not only the answerfunktion of the pocomail forung didn't work, but also the home page entrance was broken. Had to alarm Slaven first.
It's almost working... with my test contacts, the first address gets 1 attachment, the next two, then three, then four. Since I have to send about 200 invitations...
Could you have another look at it. I send you here the full new script, resp the old one with your adaptions:
- Code: Select all
{### send_to_all_address_book
{ Script will send a prepared message to
{ all recipients listed in the chosen address book
{ Usage: use only manually, do not use on
{ Incoming or Outgoing mail
{ Initialize user settings: }
External $userdata1 "Address book name to send mail to (don't enter file extension):" "Zürichtest"
External $userdata2 "Enter subject of the message:" "Einladung"
External $userdata3 "What account would you like to send it from? %accounts%" "ABC"
External $userfile1 "Message Body..." nichtimmerleicht.pdf
Set $attachment "C:\Users\abca\AppData\Roaming\Pocomail\Templates\\nichtimmerleicht.pdf"
FileExists &flag $attachment
If &flag Then AttachmentExists
Set $t ""
AddStrings $t "The PocoScript " $PocoScriptName " can't find the file\n" $attachment
MessageBox $t
Exit
:AttachmentExists
{ Read address book into the variable: }
Set $path $addresspath
AddStrings $path $userdata1
AddStrings $path ".ini"
OpenBody $addresses $path
{ Open the template to be sent: }
OpenBody $template $userfile1
{ Set the upper boundary for search through addresses: }
LineCount #count $addresses
Dec #count
{ Set initial value of the counter }
set #i 0
{ Start the loop to collect all addresses into $ToSend }
:Loop
GetLine $a #i $addresses
{ Single record: First, Last and Addresses are loaded into a multiline var: }
ReadCSV $entry $a
LineCount #lines $entry
if #lines < 3 then Next
{ Addresses (could be more than one) are loaded into a new multiline var: }
GetLine $q 2 $entry
ReadCSV $set $q
AppendBody $ToSend $set
:Next
Inc #i
if #i > #Count then Leave
goto Loop
:Leave
LineCount #c2 $ToSend
Dec #c2
{ Set initial value of the counter: }
set #i 0
{ Setup the outgoing message: }
SetAccount $userdata3
CreateMessage %m
SetHeader %m "X-Account:" $userdata3
AppendToFile true
ReadEmail $e
SetHeader %m "From:" $e
{ Start the loop to send messages to all $ToSend addresses: }
:Loop2
GetLine $a1 #i $ToSend
AddTo %m $a1
AssignBody %m $template
SetHeader %m "Subject:" $userdata2
{ The next script line added 2010-11
AttachFile %m $attachment
SaveMessage %m "out.mbx"
ClearTo %m
Inc #i
if #i > #c2 then Out
goto Loop2
:Out
Exit