Home

Macros and Programming

 

CardboxForumsMacros and Programming > "bulk email macro not filling in To: field"

bulk email macro not filling in To: field

Current user: [none]
Register / Log In · Help

Posted By Post

jury

7-Aug-2012 09:05

Using the standard bulk email macro the To: field is ether blank or states Undisclosed recipients: ;,

Thanks for any help you may give

PS I first used Cardbox back in the early 1980's on a Cambridge Research Machine running CPM as an operating system.

Here is the standard macro (my field names are: EMAIL and NAME) :

 ' For ways in which you can modify this macro,
 ' open the Tools > Bulk Email command and hit F1 for online help.

SendEmail20120807_21bb7f6 Records,1,Records.Count ' Send email (automatically generated)

Sub SendEmail20120807_21bb7f6(recs,first,last) ' (automatically generated command)
 recs.Tag cbxTagBlackOn,first,last
 Dim oldStatus : oldStatus=StatusText
 StatusText="Sending email..."
 Dim sender
 Set sender=EmailSender
 '01
 sender.Subject="BAILII 1st Annual Lecture"
 sender.Message=ClipboardText
 Dim recsAdded : Set recsAdded=recs.Database.NoRecords
 Dim recsPreload(50),lastPreload : lastPreload=0

 Dim i,rec,text
 For i=first To last
  If i>lastPreload Then
    lastPreload=i-1+50 : If lastPreload>last Then lastPreload=last
    Dim j
    For j=i To lastPreload : Set recsPreload(lastPreload+1-j)=recs(j) : Next
    For j=i To lastPreload : recsPreload(lastPreload+1-j).Preload("EMAIL,NAME") : Next
    End If
  Set rec=recs(i)
  StatusText=rec.Fields("EMAIL")
  If sender.AddRecipient(EmailNameAndAddress(rec.Fields("NAME"),rec.Fields("EMAIL")),16) Then
    recsAdded.Add rec
    If recsAdded.Count >= BATCHLIMIT Then
      sender.Send
      recsAdded.Tag cbxTagBlackOff
      Set recsAdded=rec.Database.NoRecords
     End If
   Else
    If recsAdded.Count>0 Then
      sender.Send
      recsAdded.Tag cbxTagBlackOff
      Set recsAdded=rec.Database.NoRecords
      End If
   End If
  Next
 If recsAdded.Count>0 Then
   If sender.Send(,False) Then recsAdded.Tag cbxTagBlackOff
   End If
 StatusText=oldStatus
 End Sub ' End of automatically generated SendEmail20120807_21bb7f6

bert

7-Aug-2012 23:42

I tested the recorded macro. Got the same result.
Perhaps this is a feature...
Perhaps there is a workaround.
If I will find something, I will let you know.
Also good to mail this to support@cardbox.com.

Regards
bert

bert

8-Aug-2012 09:33

Well,

I wonder why you get 16 in this line:

If sender.AddRecipient(EmailNameAndAddress(rec.Fields("NAME"),rec.Fields("EMAIL")),16) Then

Helpfile subject AddRecipient method (EmailSender object) does not mention 16. So I think the default 0 is used here.

It is a pity that there is not programmed automatic there is a kind of message as: Undisclosed recipients

However there is a way:
Add two time a line with a valid email address (I think senders address would be fine)

before this line:
    sender.Send
Add in your macro:
    sender.AddRecipient "receivers of my information<sender@domain.co.uk>",2

Have attention: sender.Send occurs two times in your macro.

Hope this will help you.
Regards
Bert

Quick Reply

Please log in or register before trying to post a reply.

 
© 2010 Cardbox Software Limited   Home