Results 1 to 12 of 12

Thread: [RESOLVED] Outgoing Mail Client with VB6

  1. #1

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,852

    Resolved [RESOLVED] Outgoing Mail Client with VB6

    Ok, another one where I'm outside of my strong suits.

    And, I've done a bit of searching and haven't found anything that exactly meets my needs (although I'll keep searching).

    Ok, here's the situation:

    I've got a Synology NAS box, and I've just spent the last couple of days getting a mail server going on it. There's also a mail client that works through web pages, but I haven't looked into how that works at all, but it works.

    I've also got a domain name registered for this email server. Right now, I'm just using the address admin@[domainname].org and it's working.''

    Also, just FYI, I've got a static IP address, had it for years.

    And more FYI, this is all for my wife who is a university professor involved in nursing research. She's currently studying the effects of care for Covid patients on nurses' well being.

    She's got a couple of large email lists and has asked me to help getting out a bulk email, so she can administer a small questionnaire to willing nurse participants. And, as you probably know, most typical mail servers don't like sending out these bulk emails.

    ------

    So, here I am setting up a mail server, which seems to be going well.

    And, here's the question. The little Synology mail client doesn't have any "bulk" capabilities (at least not that I've found). So, I'd like to write this in VB6.

    So, just an outgoing mail client. Obviously, the mail server uses SMTP for this, but I'm just not familiar with how a mail client would interface with a mail server.

    Any help, or links, would be greatly appreciated.

    Thanks,
    Elroy
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  2. #2

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,852

    Re: Outgoing Mail Client with VB6

    I don't see any harm in letting y'all know the domain name. Here's a screenshot of all the SMTP setup in the little Synology (webpage based) mail client:

    Name:  smtpclient.jpg
Views: 344
Size:  15.7 KB

    So, there doesn't seem to be that much to making this interface.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  3. #3
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,053

    Re: Outgoing Mail Client with VB6

    There were some decent free ActiveX dlls for mail sending, I cant remember the name of the one I used though.
    Chilkat might have one not sure if free.
    Outlook automation comes to mind as the most robust way to go.

    I do have a old winsock mail client I wrote quite early in my coding career:
    http://sandsprite.com/openSource.php?id=3

  4. #4
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,392

    Re: Outgoing Mail Client with VB6

    Not sure how much effort you want to put into this. When I have needed the same type of functionality, I used a program simple program (AutoMail?) that had its own email sender built in. I will check on the details of what I used and post an update.

  5. #5

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,852

    Re: Outgoing Mail Client with VB6

    Ok, I found this little program here that uses the cdosys.dll that provides me a core to do precisely what I want to do.

    I've already tested it with my new email server, and it works, so I'm good to go.

    Thanks for the considerations,
    Elroy
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: [RESOLVED] Outgoing Mail Client with VB6

    There are a lot of poor examples floating around. Most of them seem to be hacks of hacks of some very old ASP VBScript code examples.

    There isn't much to it though, especially if you use the predefined field names from the typelib:

    Code:
    Option Explicit
    '
    'For Windows 2000 or later. Requires a reference to:
    '
    '   Microsoft CDO For Windows Library
    '
    
    Private Sub SendMsg()
        With New CDO.Message
            With .Configuration.Fields
                .Item(cdoSendUsingMethod).Value = cdoSendUsingPort
                .Item(cdoSMTPServerPort).Value = 465
                .Item(cdoSMTPServer).Value = "smtp.comcast.net"
                .Item(cdoSendUserName).Value = "j.j.veeble"
                .Item(cdoSendPassword).Value = "CleverSecret"
                .Item(cdoSMTPUseSSL).Value = True
                .Item(cdoSMTPAuthenticate).Value = cdoBasic
                .Update
            End With
            .From = """Jay Veeblefester"" <jveeb@comcast.net>"
            .To = """Billy"" <wwildman@yahoo.com>"
            .Subject = "Some more really spiffy mail for you!"
            .TextBody = "This is some mail I think you'll want." & vbNewLine _
                      & "Be sure to read the attachment."
            .AddAttachment App.Path & "\attach.txt"
            
            On Error Resume Next
            .Send
        End With
        
        If Err.Number <> 0 Then
            MsgBox "CDO error " & Hex$(Err.Number) & vbNewLine & Err.Description, _
                   vbOKOnly Or vbExclamation, _
                   Caption
        Else
            MsgBox "Mail sent!", vbOKOnly, Caption
        End If
    End Sub
    Name:  sshot.png
Views: 293
Size:  7.0 KB
    Last edited by dilettante; Sep 1st, 2020 at 09:09 PM.

  7. #7
    Frenzied Member
    Join Date
    Dec 2012
    Posts
    1,470

    Re: [RESOLVED] Outgoing Mail Client with VB6

    I have used this email client program for years:
    https://www.vbforums.com/showthread....VB6-JACMail-V3

    When an email is sent to a server using a mail list, the server separates the body from the header information, and creates a header for each recipient. It then combines the body with each header one at a time and sends it out.

    The above client does not support HTML or encryption, but does support mail lists. "Cc:" sends a copy to each member of the list along with all of the recipient names. "Bcc:" or Blind Carbon Copy sends the same copy, but without advertising all the recipients. It is advisable to use "Bcc:", because some email clients (usually web based) will forward a response to all recipients on the list when using "Cc:".

    I trust that your fixed IP address is on a business account, because most North American service providers block port 25 on non-business accounts. Also be aware that once hackers learn that you are operating a mail server, it will get bombarded by attempts to learn account information for the purpose of sending spam/scam/malware. Most service providers now employ sophisticated spam detection equipment in front of their actual mail server.

    J.A. Coutts

  8. #8
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,120

    Re: [RESOLVED] Outgoing Mail Client with VB6

    For a proper mail exchange (MX) server first you need to fix your reverse DNS lookup with your ISP.

    Code:
    C:\Users\wqw>nslookup nurseresearch.org 8.8.8.8
    Server:  dns.google
    Address:  8.8.8.8
    
    Non-authoritative answer:
    Name:    nurseresearch.org
    Address:  64.253.210.146
    
    
    C:\Users\wqw>nslookup 64.253.210.146 8.8.8.8
    Server:  dns.google
    Address:  8.8.8.8
    
    Name:    host-64-253-210-146.dtccom.net
    Address:  64.253.210.146
    The reverse DNS zone for your static IP is hosted by your ISP and they need to add a record for 64.253.210.146 pointing back to your beautiful domain, not a synthetic name as above.

    Another option when you have a whole subnet of IPs (e.g. 4, 8, 16 or 256) is for you to host a DNS server that resolves in-addr.arpa reverse zone for your subnet. This is more complicated of course so for single IPs it should be possible to one-time register the domain with your ISP's zone. It has to be explained that an MX will be hosted and that is the reason for this change request.

    Other than reverse DNS administrative complications self-hosting a mail server is trivial. Some say playing hide and seeks with spammers gets annoying very quickly.

    cheers,
    </wqw>

  9. #9

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,852

    Re: [RESOLVED] Outgoing Mail Client with VB6

    Hmmm, well, I've actually got a son who knows much more about this stuff than I do.

    And yeah, he's also got a NAS box, but his port 25 was blocked. Checking port 25 on my ISP was the first thing we did. My IP isn't on a commercial account, but we do pay for the highest personal level, and we also live in the country. Our ISP is a podunk ISP that I'm sure none of you have ever heard of before. But (unless we go to satellite) it's the only thing we can get out here. Actually, it's sort of a blessing because they don't do all the checks that larger ISPs do.

    I also pay my ISP for a static IP, which my major client required for their Cisco VPN into their WAN.

    My son and I worked together to get the Synology Mail Server all up and running, after I (or actually my wife) had registered a new domain name and hooked it up to my IP through afraid.org. That part was fairly easy.

    But it took time to get all the settings correct in the mail server, many things I'd never messed with before. We've even got a certificate and are sending out everything encrypted, and tested that.

    To check things, we used a combination of the following websites, which I'd never used before:

    https://www.checktls.com/TestReceiver
    https://mxtoolbox.com/SuperTool.aspx

    After lots of fiddling and diddling, we seem to have gotten the email server set up correctly.

    On Synology, there's also an email client, but I doubt I'll ever check it, so people can send all the garbage and spam emails they want. From what I saw, there are no spam filters at all, but I don't care.

    Again, the primary purpose for all of this is so my wife can do clinical nursing research.

    On the little bulk email sender that I got going last night (with the cdosys.dll), I've got a five-second "sleep" between emails. On my wife's computer, it's actually grinding away right now.

    My son and I tested with about 12 different email accounts we had access to. Even with a certificate and encryption, we were still hitting "spam" folders about 50% of the time. We ultimately decided that there's just nothing we can do about that, and that spam filters are just taking more of a "whitelist" (rather than "blacklist") approach these days. Therefore, since this was a new (.ORG) domain name, there's just not much we can do. But, 50% into inboxes really isn't that bad. We teased that we're now all ready to send out phishing emails to little-old-ladies, but would never actually do that. (And, for those reasons, I don't think I'll go through every nuance that we went through to get the mail server setup.)

    Y'all Take Care,
    Elroy
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  10. #10
    Frenzied Member
    Join Date
    Dec 2012
    Posts
    1,470

    Re: [RESOLVED] Outgoing Mail Client with VB6

    There are a number of ways that mail servers use to detect spam.
    1. Black Lists
    2. Reverse lookup (PTR) of sender IP does not agree with forward lookup (A) of domain name
    3. SPF
    4. DKIM
    5. DMARC
    etc

    These usually result in rejection of the email before the body of the message, so the sender knows the message was not received.

    After the message is received, there are a number of programs (eg Vadesecure) that will analyze the content of the message. Points are awarded for each questionable item encountered, and if the point value exceeds a certain value the message is quarantined (sometimes called Junk). The sender is not usually informed of the quarantine.

    One of the items awarded points is if the message contains HTML. Virtually all malware, and most spam is sent using HTML. Surveys reveal that most people prefer HTML encoded email, but those same surveys also reveal that HTML encoded emails are by far the ones that never get read. HTML encoded email can be configured to verify that the recipient opened the email. Text based emails are more likely to be read by the recipient.

    J.A. Coutts

  11. #11
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,120

    Re: [RESOLVED] Outgoing Mail Client with VB6

    > 2. Reverse lookup (PTR) of sender IP does not agree with forward lookup (A) of domain name

    This looks like the main OP problem.


  12. #12

    Thread Starter
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,852

    Re: [RESOLVED] Outgoing Mail Client with VB6

    Ooookkaayyy, we've contacted our ISP and asked what it'd take to get one of these PTR reverse lookup records into their IP database. Since we've been paying $10/month for years for our static IP, hopefully they'll be a bit accommodating. I guess we're at their mercy regarding this.

    EDIT: Right now, a reverse lookup returns their (the ISP's) domain name.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

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