Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook, VB, Redemption problem

Status
Not open for further replies.

simonkue

MIS
Jul 9, 2002
105
GB
Wonder if anyone can help.....

I'm trying to generate bulk e-mails from a VB6 (SP4) app. My pc is Win2k SP4 and Outlook is 2k SR1. This worked fine but when I use Outlook GT 2002 on another pc I got the security message and so have started to try Outlook Redemption.
When testing on my old pc now using the code in the redemption manual, VB6 crashes whenever it is used. The crash (error message is "Program error. VB has generated errors and is closing) seems to occur after the e-mail item has been generated - as if a link between redemption and Outlook has a problem and VB cannot cope with the response.

Any ideas as to things I should check.
 
Could you show us the code you are using and the line(s) that you encounter the error?

Cheers

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
>bulk e-mails

It sounds like something I encountered about 6 months or so ago

There's a under-documented feature of the To:, cc: and bcc: fields - they are are each limited to 32K. If this limit get's hit as Outlook resolves the email addresses (because when resolving, Outlook takes the simple 'johndoe@somewhere.com' text that you might have typed and internally represents it in a generally longer format) then you'll get an error that Redemption doesn't handle well

The only fix we could come up with was to reduce the number of people we were sending to in each mail
 
strongm,

Thanks for your response. For testing I'm only using 2 e-mail addresses and not using the cc or bcc fields.
In addition, I'm creating one e-mail for each e-mail address via a loop within the VB code - so for each test I expect 2 separate e-mails in my outbox.
Also, not sure if it's relevant but the e-mails now don't appear in the outbox immediately. They get there between 1 and 15 minutes after my pgm thinks they've been created!
 
Here is the function I use to create the e-mail. This is called within a loop for n e-mail addresses.

Function CreateMail(xsRecip As Variant, xsSubject As String, xsMsg As String, _
Optional xsAttachments As String) As Boolean

' Create new e-mail

Dim xvRecip As Variant
Dim xvAttach As Variant
Dim xbResolveOK As Boolean
Dim xnLen As Integer

Dim oMailItem As Object
Dim oMail As Object

Dim SafeItem, oItem
'Dim orSafeMailItem As New Redemption.SafeMailItem

On Error GoTo CreateMail_Err

' Get the message text. If xsMsg=Clipboard, then that is where the text is
If xsMsg = "Clipboard" Then
xsMsg = Clipboard.GetText
End If

xnLen = Len(xsMsg) + 1

Set SafeItem = CreateObject("Redemption.SafeMailItem")
Set oItem = Application.CreateItem(0)
SafeItem.Item = oItem

With SafeItem
.Item = oItem
.Recipients.Add xsRecip
.Recipients.ResolveAll
.Subject = xsSubject
.Body = xsMsg
.Send
End With

CreateMail = True

'Set oMailItem = Nothing
'Set orSafeMailItem = Nothing
'Set xgolApp = Nothing
'
CreateMail_End:
Exit Function

CreateMail_Err:
CreateMail = False
Resume CreateMail_End
End Function
 
Further update after more testing....

On the pc used above, the VB dev environment crashes when I return from the routine above. If I take the code above and run it within the loop and reinstate the Set orSafeMailItem=Nothing, the VB dev env crashes when it executes that line.
On another pc (pc#2), with the same Win/VB/Outlook versions, it generates e-mails but puts them into the drafts folder! Clearly this pc has some different setup setting/s. Anyone know what I should look for?
Any ideas why on pc#2 the generated e-mail goes to drafts and not to outbox and how to force it to go to outbox?
 
Latest update following feedback from microsoft newsgroup:

Output of emails to Drafts is not a problem. They still get sent when Outlook is scheduled to send/receive.

Still have the crashing problem on one pc though. Think it may be to do with Outlook or Redemption settings.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top