Smart Tech Diary

The Smart Tech Diary

We recommend Divi Theme For WordPress

  • HOME
  • ABOUT
  • Topics
    • Programming
    • Computing
    • Hacking
    • Electronics
    • Web Design
  • CONTACT
  • Subscribe
  • Hacking Disclaimer
  • Privacy
You are here: Home / Programming / How to develop a commercial e-Statement solution in vb6 step by step – Part 6 – Send Mail Using Gmail SMTP Server

How to develop a commercial e-Statement solution in vb6 step by step – Part 6 – Send Mail Using Gmail SMTP Server

18th May 2015 by Abdalla Nizar 6 Comments

Building a Commercial e-Statement Application in VB 6 – Send Mail Using Gmail SMTP Server

Am glade you find time to visit our website. If this is your first time on this website and you want to learn how to develop your own e-Statement application from scratch go to the beginning where it all started E-statement Basics

As we go on with the development of this e-Statement application, at some point we will need to start testing sending emails from the application. And for this to happen we require to have SMTP Server which will send the mails. So in today`s post we will take a look at how to send mail using Gmail SMTP server in vb6.

In Summary, we are going to do the following in this article

  1. Set access for less secure apps
  2. Send Mail Using Gmail SMTP Server
  3. Test your application

Set access for less secure apps in GMail

This part is crucial if we want to use Gmail SMTP Server to send mail via vb6. Login to your Gmail account. Click on “Account”

www.smarttechdiary.com Send Mail using Google SMTP Server in vb6

and go to the “Signing In” set “Access for less secure apps” to Allowed

www.smarttechdiary.com Send Mail using Google SMTP Server in vb6

The above step is a must because before we send mail through Google`s SMTP Server we need to authenticate and the authentication will be blocked if we have not “Allowed” access for less secure apps.

 

Send Mail Using Gmail SMTP Server

Once we have “Allowed” access for less secure apps in Gmail we are now ready to send a test mail using Gmail SMTP Server. This is important for the e-Statement application because going forward we are going to use these same settings to send our e-Statements.

Open your SmartMail in your Visual Basic IDE and add a Form. Add one Command Button and name it as cmdSendMail. Double click the command button and add the below code. Please change the Username and Password in the code to use your Gmail Email Address and Password.

www.smarttechdiary.com Send Mail using Google SMTP Server in vb6

Just as a reminder , you will need to reference the CDO Library for the code below to work properly.

www.smarttechdiary.com Send Mail using Google SMTP Server in vb6

'eStatement Application Development
'Send Mail Using Google`s SMTP Server
'www.smarttechdiary.com
Private Sub cmdSendMail_Click()
Dim myMail As CDO.Message

Set myMail = New CDO.Message

myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "smarttecdiary@gmail.com" 'Your Gmail Account
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "YourGmailPassword" 'Your Password

myMail.Configuration.Fields.Update

With myMail
.Subject = "Your Monthly e-Statement - SMART TECH DIARY DOT COM"
.From = "smarttecdiary@gmail.com"
.To = "smarttecdiary@gmail.com"
.CC = ""
.BCC = ""
.TextBody = "The Smart Tech Diary"
End With
On Error Resume Next
myMail.Send
MsgBox ("Sent")
Set myMail = Nothing
End Sub

Run your project and test your SMTP Sever settings

www.smarttechdiary.com Send Mail using Google SMTP Server in vb6

I received the test mail as below which means the SMTP Server settings are working correctly on my side

www.smarttechdiary.com Send Mail using Google SMTP Server in vb6

If you have any questions,kindly contact me I will try my best to help you out. Have a nice week. If you like these posts kindly share with your friends by clicking the buttons below.

 

 

Share this:

  • Reddit
  • Email
  • Print
  • WhatsApp
  • Skype

Related

Filed Under: Programming Tagged With: bank estatement, bank statement, bank statement dbs, E-Statement, estatement, online estatement

Comments

  1. UDAY says

    16th October 2018 at 2:03 pm

    showing sent but not received in my gmail id

    Reply
    • Abdalla Nizar says

      30th November 2018 at 5:03 pm

      Hi Uday, did you check your spam folder?

      Reply
  2. Karthick says

    11th December 2021 at 12:01 pm

    Error in loading DLL

    Reply
  3. Abdalla Nizar says

    17th December 2021 at 8:47 am

    Hi Karthick,
    Please check if you have included cdosys.dll

    Reply

Trackbacks

  1. Send Mail in VB6 Using Gmail SMTP & Ping Using VB6 says:
    29th June 2015 at 9:09 am

    […] Send Mail Using Gmail SMTP Server […]

    Reply
  2. Download E-statement Solution Source Code for Free says:
    30th August 2015 at 11:08 am

    […] Send Mail Using Gmail SMTP Server […]

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

WordPress-Security-For-Non-Geeks

Subscribe to Download The E-Book

* indicates required

Recent Posts

  • Why I will never use nulled WordPress themes again
  • New WordPress 4.8 has been released, Don’t Be Late
  • WikiLeaks reveals Grasshopper Malware, the CIA’s Windows hacking tool
  • The Ultimate WordPress Security Guide 2017 | How To Secure Your WordPress Website
  • How to purchase data bundle for Airtel postpaid lines

Categories

  • Computing
  • Databases
  • Digital Marketing
  • Electronics
  • Hacking
  • Kenya How Tos
  • Programming
  • Web Design
  • Wordepress Security
  • WordPress

Copyright © 2023 · The Smart Tech Diary