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 10 – Create HTML Email Body Configuration Form

How to develop a commercial e-Statement solution in vb6 step by step – Part 10 – Create HTML Email Body Configuration Form

22nd July 2015 by Abdalla Nizar 1 Comment

Create HTML Email Configuration Form for the E-statement

Our E-statement application will be used to send clients Bank Statements at certain intervals and some configurations needs to be changed when sending these mail.

In the next article we are going to create HTML email body for the e-statement but for this article we are going to manage the following settings for the email body.

  1. Email Body Sections
  2. Email Subject
  3. Company Header Logo
  4. Company Adverts Section
  5. Disclaimer

Email Body Sections

Apart from the PDF Statement attachment to the email, the email has a section for Adverts. We can include adverts at the bottom of the email body as part of the e-statement.

Create html email

 

Company Header Logo

This section will hold the company logo. The company logo can be changed by providing a different logo using this configuration form.

Logo Format = PNG

Width = 632

Height =  57

Sample Logo

HeaderLogo

Company Adverts Section

The advert section is provisioned to add adverts as part of the email body. It is inform of an image.

 

Advert Format = PNG

Width = 566

Height = 223

 

Sample Advert Image

Advert

 

Once we have understood the HTML Email sections we can go ahead and create a configuration form which will allow us to set up the variables.

SQL App Settings Table Columns

We need to make some changes to our App Settings Table in the Smart Mail SQL database as below:

www.smarttechdiary.com-create-html-email-SQL-AppSettings

HTML Email Configuration Form

Create a Form and name it “frmEmailBody” with a caption of “Email Body Configuration”

https://www.smarttechdiary.com

Add the following controls on the form.

Control Name Caption 
 Frame Frame1 E-Statement Message Body Configuration
 Common Dialog cdEmail
 Common DialogcdStatement
 Text Box txtSubject
 Text Box txtEmailAdvertImage
 Text Box txtEmailStatementLogo
 Command Button cmdSave &Save
 Command Button cmdExitE&xit
Command ButtoncmdEMailAdvertBrowse
Command ButtoncmdStatementAdvertBrowse
 Check Box CheckChangeLogo Change Logo
LabelSubject
LabelAdvert Image
Label Header Logo
Label(e.g Your July e-Statement)
LabelBottom Advert
LabelHeader Logo

SOURCE CODE

Once we are done with setting up the form. We can now add code to it. Copy and paste the code below to your form and test.

'How to develop a commercial e-Statement solution in vb6 
'eStatement Application Development
'Create HTML Email Configuration
'ping using vb6
'Send Mail in VB6 Using Gmail SMTP, Ping Using VB6,Create HTML Email
'www.smarttechdiary.com




Private Sub CheckChangeLogo_Click()
'Enable/Disable Changing Of Header Logo
If CheckChangeLogo.Value = Checked Then
        txtEmailStatementLogo.Enabled = True
        cmdStatementAdvert.Enabled = True
        txtEmailStatementLogo.BackColor = &H80000005
    Else
        txtEmailStatementLogo.Enabled = False
        cmdStatementAdvert.Enabled = False
        txtEmailStatementLogo.BackColor = &H8000000B
    End If
End Sub

Private Sub cmdEMailAdvert_Click()
'Set the Email Body Advert
 On Error Resume Next
 
    ' Clear errors
    err.Clear
 
    ' Use this common dialog control throughout the procedure
    With cdStatement
 
        ' Raises an error when the user press cancel
        .CancelError = True
 
        ' Set the file extensions to allow
         .Filter = "Image Files (JPEG,PNG)|*.jpg;*.jpeg;*.png;"
 
        ' Display the open dialog box.
        .ShowOpen
        txtEmailAdvertImage = .FileName
 
        ' Ignore this if the user has canceled the dialog
        If err <> cdlCancel Then
 
           VerifyEmailImageSize
 
        End If
 
    End With
End Sub

Private Sub cmdExit_Click()
Unload Me
End Sub

Private Sub cmdSave_Click()
'    Save E-Statement Email Body Settings
'-----------------------------------------------------------------------------------------------
On Error GoTo Error
'Check User Input
If txtEmailAdvertImage.Text = "" Then Exit Sub
If txtEmailStatementLogo.Text = "" Then Exit Sub
If txtSubject.Text = "" Then Exit Sub


Dim rsEmailBody As New ADODB.Recordset
With rsEmailBody
'    EmailSubject
'-----------------------------------------------------------------------------------------------
.Open "SELECT * FROM AppSettings WHERE SettingID=8  ", CN, adOpenDynamic, adLockOptimistic
If Not rsEmailBody.EOF Then
rsEmailBody("SettingValue") = txtSubject.Text
.Update
End If
.Close

'    EmailAdvertImage
'-----------------------------------------------------------------------------------------------
.Open "SELECT * FROM AppSettings WHERE SettingID=9  ", CN, adOpenDynamic, adLockOptimistic
If Not rsEmailBody.EOF Then
rsEmailBody("SettingValue") = txtEmailAdvertImage.Text
.Update
End If
.Close

'    EmailStatementLogo
'-----------------------------------------------------------------------------------------------
.Open "SELECT * FROM AppSettings WHERE SettingID=10  ", CN, adOpenDynamic, adLockOptimistic
If Not rsEmailBody.EOF Then
rsEmailBody("SettingValue") = txtEmailStatementLogo.Text
.Update
End If
.Close

End With
MsgBox "Updated", vbInformation
Exit Sub

Error:
MsgBox (err.Description)
Unload Me

End Sub

Private Sub cmdStatementAdvert_Click()
'Set the Email Body Header
     On Error Resume Next
 
    ' Clear errors
    err.Clear
 
    ' Use this common dialog control throughout the procedure
    With cdStatement
 
        ' Raises an error when the user press cancel
        .CancelError = True
 
        ' Set the file extensions to allow
         .Filter = "Image Files (JPEG,PNG)|*.jpg;*.jpeg;*.png;"
 
        ' Display the open dialog box.
        .ShowOpen
        txtEmailStatementLogo = .FileName
 
        ' Ignore this if the user has canceled the dialog
        If err <> cdlCancel Then
 
           VerifyStatementImageSize
 
        End If
 
    End With
     
   
End Sub
Function VerifyEmailImageSize()
'Function to Verify Email Advert Image Size
On Error GoTo ImageError
Dim myPic As StdPicture, picWidth As Long, picHeight As Long
Set myPic = LoadPicture(txtEmailAdvertImage.Text) ' supply valid path/filename
picWidth = ScaleX(myPic.Width, vbHimetric, vbPixels)
picHeight = ScaleY(myPic.Height, vbHimetric, vbPixels)
lblSize.Caption = picWidth & "x" & picHeight
If picWidth <> "566" And picHeight <> "223" Then MsgBox "Inalid Image Size", vbCritical, "Invalid Email Body Advert"
Exit Function
' handle errors should loading the picture cause an error
ImageError:
MsgBox (err.Description)
End Function
Function VerifyStatementImageSize()
'Function to Verify Header Logo Image Size
On Error Resume Next
err.Clear
Dim myPic As StdPicture, picWidth As Long, picHeight As Long
Set myPic = LoadPicture(txtEmailStatementLogo.Text) ' supply valid path/filename
picWidth = ScaleX(myPic.Width, vbHimetric, vbPixels)
picHeight = ScaleY(myPic.Height, vbHimetric, vbPixels)
lblStatementSize.Caption = picWidth & "x" & picHeight
If picWidth <> "632" And picHeight <> "57" Then MsgBox "Inalid Image Size", vbCritical, "Invalid Email Body Advert"
Exit Function
' handle errors should loading the picture cause an error
End Function
Private Sub Form_Load()
'Disable Header Logo Editing
txtEmailStatementLogo.Enabled = False
cmdStatementAdvert.Enabled = False
'Load E-Statement Message Body Settings From Database
txtSubject.Text = getValueAt("SELECT SettingValue FROM AppSettings where SettingID=8", "SettingValue")
txtEmailAdvertImage.Text = getValueAt("SELECT SettingValue FROM AppSettings where SettingID=9", "SettingValue")
txtEmailStatementLogo.Text = getValueAt("SELECT SettingValue FROM AppSettings where SettingID=10", "SettingValue")

End Sub


Share this:

  • Reddit
  • Email
  • Print
  • WhatsApp
  • Skype

Related

Filed Under: Programming Tagged With: bank estatement, bank statement, bank statement dbs, Create html email, Create html email body, E-Statement, estatement, HTML in VB.Net, HTML in vb6, online estatement

Trackbacks

  1. How to Create HTML Email Body In VB6 says:
    27th July 2015 at 8:01 am

    […] Note that the E-Statement has different sections, see this post for more E-statement Email Body Sections […]

    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