Georgian text sent incorrectly by Gmail using Excel Macro

113 Views Asked by At

I am trying to set up macros to send messages to e-mail addresses I have in Excel sheet.

I have message subject in the field F3 and a Message in the field F4

Data begins from row 14

At last it looks as follows (the macro used is at bottom of the question:

enter image description here

I execute the macro, as result mails are sent but Georgian text is broken, question marks are instead of Georgian letters.

I can not understand what is wrong here, is macro doing this or it is Gmail breaking my mail text? The result is as follows:

enter image description here

You can see that Georgian text is broken.

Any suggestions on that? What does it happens and how to correct this?

Sub SendWith_SMTP_Gmail()
'Works On Windows (Not Mac). Mac Users Should Use Zapier Integration
'Created by Randy Austin www.ExcelForFreelancers.com
Dim EmailMsg, EmailConf As Object
Dim Subj, Mess, Json, URL, LastName, FirstName, Email, Attach As String
Dim ContactRow, LastRow, SentCounter As Long
Dim EmailFields As Variant
Set EmailMsg = CreateObject("CDO.Message") 'CDO (Collaboration Data Objects) -Make sure you have the 'CDO For Windows' Library Selected
Set EmailConf = CreateObject("CDO.Configuration")
    EmailConf.Load -1    ' Set CDO Source Defaults
     Set EmailFields = EmailConf.Fields
     With EmailFields
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "[email protected]"
        .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "My-G-Mail-Pass"
        .Update
     End With
With Sheet1

    Attach = .Range("F11").Value 'Attachment Link
    LastRow = .Range("E999").End(xlUp).Row 'Get Last Row Of Table

    For ContactRow = 14 To LastRow
        Subj = .Range("F3").Value 'Email Subject
        Mess = .Range("F4").Value 'Email Message
        If .Range("L" & ContactRow).Value <> Empty Then GoTo NextRow
        LastName = .Range("E" & ContactRow).Value
        FirstName = .Range("F" & ContactRow).Value
        Email = .Range("K" & ContactRow).Value
        Subj = Replace(Replace(Subj, "#FirstName#", FirstName), "#LastName#", LastName)
        Mess = Replace(Replace(Mess, "#FirstName#", FirstName), "#LastName#", LastName)

        With EmailMsg
            Set .Configuration = EmailConf
            .To = Email
            .CC = ""
            .BCC = ""
            .From = """info"" <[email protected]>"
            .Subject = Subj
             If Attach <> Empty Then .AddAttachment Attach
            .TextBody = Mess
            .Send
        End With
        SentCounter = SentCounter + 1
        .Range("L" & ContactRow).Value = Now 'Set Send Date & Time
NextRow:
    Next ContactRow

      'Cleanup
    Set EmailMsg = Nothing
    Set EmailConf = Nothing
    Set EmailFields = Nothing
End With
MsgBox SentCounter & " Emails have been sent"
End Sub
0

There are 0 best solutions below