DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: vbSendmail works off and on

  1. #1
    Join Date
    Apr 2008
    Posts
    4

    vbSendmail works off and on

    This one has me completely baffled.

    I downloaded vbsendmail and the examples both work perfectly. I even downloaded another program called Newsletter that uses the vbsendmail.dll and it works perfectly. So I used virtually the identical code from the first example in my large (70K line) program. It also uses the mswinsck.ocx for other things. I registered the dll and selected it in the Project/References.

    When I click Send, it hesitates for a few seconds then occasionaly I get the message "Wrong protocol or connection state for the requested transaction or request." But, more often, I get the message "Timeout occurred: The STMP Host did not respond to the request."

    I've turned off all firewalls and raised the priority for the vbsendmail.dll as high as it can go.

    Any help is appreciated.

    John

  2. #2
    Join Date
    Oct 2005
    Posts
    1,819
    r u sure about the SMTP used ? is it a well workin one ?

  3. #3
    Join Date
    Apr 2008
    Posts
    4
    Yes, I'm using exactly the same SMTP Server in the SendMailExample program, which works every time. But, when I enter it in my app on the same computer it fails.

    John

  4. #4
    Join Date
    Oct 2005
    Posts
    1,819
    how you embedded it in ur app ? show some code ...

  5. #5
    Join Date
    Apr 2008
    Posts
    4
    Quote Originally Posted by Amahdy
    how you embedded it in ur app ? show some code ...
    First, I set a project reference to the vbSendMail.dll. Then, I created a frmSendEmail form. I declared:

    Private WithEvents poSendMail As vbSendMail.clsSendMail

    in the form and:

    Set poSendMail = New clsSendMail

    in the Form Load event.

    Then, for the cmdSend sub, I put:
    Code:
    Private Sub cmdSend_Click()
        cmdSend.Enabled = False
        Screen.MousePointer = vbHourglass
        With poSendMail
            .SMTPHostValidation VALIDATE_NONE                 
            .EmailAddressValidation = VALIDATE_SYNTAX   
            .SMTPHost = txtServer.Text                  
            .From = txtFrom.Text                        
            .FromDisplayName = txtFromName.Text         
            .Recipient = txtTo.Text                     
            .RecipientDisplayName = txtToName.Text      
            .CcRecipient = txtCc                        
            .CcDisplayName = txtCcName                  
            .BccRecipient = txtBcc                      
            .ReplyToAddress = txtFrom.Text              
            .Subject = txtSubject.Text                  
            .Message = txtMsg.Text                      
            .PersistentSettings = False                
            .Send                                       
        End With
        Screen.MousePointer = vbDefault
        cmdSend.Enabled = True
    
    End Sub
    When I put this exact code in a standalone exe, it will work perfectly. Then, when I put the exact same code in my large app, and use the exact same text in the same fields, including the same SMTP server on the same computer, I get the TimeOut error every time. It's like something in my app is preventing the dll from getting through to the SMTP server. I know the dll is registered properly because if I leave out necessary info, it gives me the appropriate error messages.

    I have a Winsock control and a MAPISession and MAPIMessage elsewhere in the program. I thought maybe they were somehow confusing or conflicting with the vbSendMail dll. But when I took them out of the project, it made no difference.

    I'm stumped. I really appreciate your help.

    John

  6. #6
    Join Date
    Oct 2005
    Posts
    1,819
    this is very strange, try to hard-code the values maybe there are confusions in the texts ... try to remove some controls from the project ... try to make nothing run in the project other than going directly to send an email ...
    i can't seem to know where the error now exactly without seeing your app. code completly it should be something here or here ...
    revise the code again ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center