login about faq

I inherited a legacy VB6 app that sends email using Chilkat Mail 5.1 that now needs to use SMTP TLS, but apparently the StartTLS property doesn't exist in Chilkat Mail 5.1. I downloaded and installed the newest Active X component (v9.5) and added the reference to the project, but am having trouble translating methods and properties to the new component.

Let me preface this by saying I have limited experience with VB, but here are my old declarations:

Dim Mailer As New CHILKATMAILLib.ChilkatMailMan
Dim MailFactory As New CHILKATMAILLib.EmailFactory
Dim msg As CHILKATMAILLib.IChilkatEmail

I tried using these declarations...

Dim Mailer As New ChilkatMailMan
Dim MailFactory As New ChilkatEmail
Dim msg As New ChilkatEmail

...but trying to invoke the method Set msg = MailFactory.NewEmail fails. I also tried invoking EmailBundle as MailFactory and use Set msg = MailFactory.AddEmail but that doesn't work either.

I know I'm not giving much to go on, but any help would be greatly appreciated as I an out of my depth here.

Thanks in Advance, vin

asked Feb 20 at 14:01

Vinsuz221's gravatar image

Vinsuz221
3

Just to add on, If I leave out the references to MailFactory in the code it does send the email, but the problem is it just keeps adding more and more recipients for each additional email rather than starting a new message every time (e.g. the MailFactory.NewEmail method used in v5.1).

(Feb 20 at 14:05) Vinsuz221

I think there must have been major changes to the object model since 5.1 as there doesn't appear to be an EmailFactory object anymore. You can now just create a new email object like this:

Dim msg As New Chilkat_v9_5_0.ChilkatEmail

I recommend having a look at the examples available here: https://www.example-code.com/vb6/emailObj.asp

link

answered Feb 20 at 14:46

jpbro's gravatar image

jpbro ♦
1.1k2618

Thanks jpbro, but I am already declaring ChilkatEmail -- my issue is when the application runs it sends multiple email messages, and I need a way to tell it to start a new message. I don't think I need to Dim it again every time, do I?

(Feb 20 at 14:56) Vinsuz221

There doesn't appear to be anyway to reset an existing object (though maybe I've just missed a method), so I would recommend creating a new Email object. You don't Redim it though, just set an existing object variable to a new instance, e.g.:

Dim msg As Chilkat_v9_5_0.ChilkatEmail

Set msg = New Chilkat_v9_5_0.ChilkatEmail

That said, if all of your msg properties/values are staying the same, except for the recipients, then it looks like you can clear recipients only using the ClearTo, ClearCC, and ClearBCC methods.

(Feb 20 at 15:04) jpbro ♦

Your answer led me to the solution, so I am marking it as such. Instead of Dim-ing it over and over, I simply did this:

Set msg = New ChilkatEmail

Worked like a charm! Thanks again!

(Feb 20 at 15:52) Vinsuz221
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×200
×89
×51
×5
×4

Asked: Feb 20 at 14:01

Seen: 356 times

Last updated: Feb 20 at 15:52

powered by OSQA