Login  
Search All Forums
Dart Home | PowerTCP Mail for ActiveX | Custom Development Reply | PowerTCP Mail for ActiveX Topics | Forums   
AuthorForum: PowerTCP Mail for ActiveX
Topic: SMTP - using Send v QuickSend
Stephen Cheek
mail@stephencheek.com

From: Colchester, United Kingdom
Posts: 4
Member Since: 02/05/05
posted February 5, 2005 10:24 AM

I have just started using PowerTCP Mail Tool in VB6. All seems fine & using the SMTP tool I can easily send messages with attachements using the QuickSend method - absolutely no problems. 
However, if I use the Send method instead, any attachments seem to be included TWICE, or even three/four times if I send consecutive messages, and any line feeds in the mssage body (using vbCrLf) are ignored. What am I coding incorrectly?

Sample of my code:
>>>>>>>>>>>>>>>
Private Sub SendMessage   
On error Goto CloseOut    

With SMTP1
    .Timeout = 10000    
    .Message.To.Add RecipientName
    .Message.From = Sender
    .Message.Subject = SubjectName
    .Message.Text = MessageText
    .Message.AddAttachment AttachmentName
    .Login ServerName    
    .Send
    .Logout
End with

Exit Sub

CloseOut:
    Smtp1.Abort
  
End Sub
>>>>>>>>>>>>>>>>>>

Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted February 5, 2005 10:39 AM

You aren't resetting the message, so you keep adding the attachment. Also using your code, every address would get multiple copies except the last one.

If you take a look at our sample SMTP client you will note that we call Smtp.Message.Content = "" prior to each send.

Stephen Cheek
mail@stephencheek.com

From: Colchester, United Kingdom
Posts: 4
Member Since: 02/05/05
posted February 5, 2005 11:03 AM

Tony - thanks. Your advice has resolved the multiple attachments problem, but now I find that the received e-mail has nothing in the main message body. ANy further ideas?
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted February 5, 2005 11:05 AM

Do you see the same problem if you run our sample?
Stephen Cheek
mail@stephencheek.com

From: Colchester, United Kingdom
Posts: 4
Member Since: 02/05/05
posted February 5, 2005 11:20 AM

Tony - running your sample is fine, so I have obviously not correctly used the various properties/methods etc somewhere along the line! I'll take a raincheck now & double-check all my bits of code against your sample to find out what's wrong. Many thanks for your help - if I have not resolved this by the end of the weekend I may be back, but I'm sure that will not be the case!
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted February 5, 2005 12:12 PM

In my reply, I said "prior to each send". If you did exactly that, then that may be the problem. I should have said "prior to contructing the message". Setting Content to "" clears the message of all content.

I would still look at the samples though.
Stephen Cheek
mail@stephencheek.com

From: Colchester, United Kingdom
Posts: 4
Member Since: 02/05/05
posted February 6, 2005 10:29 AM

Tony - I found that I had incorrectly copied/modified some lines of the sample code in my own test application. All now fine. In most cases of course I am using the QuickSend method, which seems to pretty well look after itself, but I was trying to get the Send method sorted out because it would seem that I have to use this in cases where I need to login to the SMTP server with a username/password (the QuickSend method does not have this option).
Anyway, very many thanks for your fast, couteous and accurate advice.
Reply | PowerTCP Mail for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX