Results 1 to 7 of 7

Thread: Sending mail with VB 6.0

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2007
    Posts
    3

    Sending mail with VB 6.0

    Ok,i'm trying to send mail with this library http://www.freevbcode.com/ShowCode.Asp?ID=109

    Code:
    Private Sub Command1_Click()
    
    Set poSendMail = New vbSendMail.clsSendMail
    poSendMail.UsePopAuthentication = True
    poSendMail.ConnectTimeout = "50"
    poSendMail.SMTPHost = "smtp.abv.bg"
    poSendMail.SMTPPort = "25"
    poSendMail.POP3Host = "pop3.abv.bg"
    poSendMail.UserName = "whatever"
    poSendMail.Password = "whatever"
    
    poSendMail.From = "[email protected]"
    poSendMail.FromDisplayName = "whatever"
    poSendMail.Recipient = "[email protected]"
    poSendMail.RecipientDisplayName = sashko
    poSendMail.ReplyToAddress = "[email protected]"
    poSendMail.Subject = "whatever"
    poSendMail.Message = "whatever"
    
    poSendMail.Send
    Set poSendMail = Nothing
    
    End Sub
    And i'm getting the following error "Authentication failed".What cause this?Does anyone knows?Note that username,password and the SMTP and POP3 hosts are correct.I really don't know what's wrong.Sorry if that's wrong place for this thread.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Sending mail with VB 6.0

    Welcome to the forums.

    Are you sure Port 25 is the right port?

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2007
    Posts
    3

    Re: Sending mail with VB 6.0

    This is from documentation of the library - "The SMTP port on the remote host. This property has a default value of 25, which conforms to the SMTP standard. Unless you are sending mail via a machine where the SMTP port was changed to a non-standard value, you don't have to set this property."

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Sending mail with VB 6.0

    Some ISP's block port 25 as its commonly abused by apps for sending spam.
    You may need to put into your app a option to enter in the desired port number that their ISP will allow in these cases. A common bypass is port 2525.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    New Member
    Join Date
    Oct 2007
    Posts
    3

    Re: Sending mail with VB 6.0

    Ok,there is something else,this code must be working properly but here is the problem,i tried with SMTPHost of another mail "smtp.icmail.net" and doesn't work.After that i tried with "smtp.gmail.com" of course i've changed port and other things and when i run the program i get the following message in the Status event
    "Connecting to POP3 server (mail.icmail.net" and after that an error which says that the password or username is wrong.Note that i use the code below!!!!!***?What POP3 server,what "mail.icmail.net"???For second time...i'm using the posted code below.The program always tries to connect to "mail.icmail.net" I've created new project which use the same code but the same thing happens.
    Last edited by cygnusX; Nov 11th, 2007 at 03:03 PM.

  6. #6
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Sending mail with VB 6.0

    most of the vbsendmail settings are saved in the registry, though it appears that your code should still connect to the correct server,
    put a breakpoint on the send line and test the value of smtphost and port
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Sending mail with VB 6.0

    Some free mail services dont allow smtp connections like what vbSendMail is trying to do.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width