Results 1 to 7 of 7
  1. #1
    kdbailey is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2012
    Posts
    228

    CDO.Message Signature

    I'm in the midst of setting up a program to email out to miscellaneous recipients and am looking how to attach a signature through G-Mail. I am either open to attaching a signature previously created within the gmail account, or to create one using VB. Currently the gmail account has a signature made, but doesn't attach with my current code.



    Does anybody have any experience with this? Below is my current code, the emails currently send out fine.

    Current code:
    Code:
    Function dealeremail(whichemail As String)Dim rsemail As Recordset, rsclaim As Recordset, subj As String, numparts As Integer, parts As String, partfield As String, qfield As String
    Dim fsfile As File, fso As FileSystemObject, srcfolder As Folder, filenm As String, ibp As CDO.IBodyPart
    
    Set cdomsg = CreateObject("CDO.message")
    
    
        With cdomsg.Configuration.Fields
            .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/smptserverport") = 587
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
            .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "xxx@gmail.com"
            .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "xxx"
            .Update
        End With
    
        With cdomsg        
            '.To = "xxx@xxx.com"
            .To = rsemail.Fields("Email")
            .BCC = "xxx@xxx.com, xxx@xxx.com"
            .From = "xxx@gmail.com"
            .Subject = subj
            .TextBody = msg
            Set fso = New FileSystemObject
            Set srcfolder = fso.GetFolder("S:\Shared\Warranty Returns\WRA Data Storage\Backups\Dealers\" & rsclaim.Fields("Dealer Number") & "\" & rsclaim.Fields("Serial Number") & " " & rsclaim.Fields("Claim Number") & "\Initial\")
            If srcfolder.Files.Count > 0 Then
                For Each fsfile In srcfolder.Files
                    If InStr(1, fsfile.Name, "Thumbs") = 0 Then Set ibp = .addattachment(fsfile.Path)
                Next
            Else
                GoTo attacherror
            End If
            Set fso = Nothing
            Set srcfolder = Nothing
            .Send
        End With
    skip:    
        Set rsemail = Nothing
        Set rsclaim = Nothing
        Set cdomsg = Nothing
    
    
    End If
    
    
    Exit Function
    
    
    parterror:
    
    
    MsgBox "No parts", vbOKOnly
    
    
    Set rsemail = Nothing
    Set rsclaim = Nothing
    Set cdomsg = Nothing
    
    
    Exit Function
    
    
    attacherror:
    
    
    MsgBox "Attachment error.", vbOKOnly
    
    
    Set rsemail = Nothing
    Set rsclaim = Nothing
    Set cdomsg = Nothing
    
    
    End Function

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    The 'signature' could just be more text tacked onto the end of the message body.

    That is probably easier than trying to pull signature from gmail.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    kdbailey is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2012
    Posts
    228
    I am guessing that I would likely have to set it up as an HTML body then?

    I am quite unfamiliar with HTML and don't have much of a clue how to set up fonts and images. Could you assist with this?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    I guess if you want the signature to have special fonts and links and embed image, need HTML. It's not difficult. Here is a good site to learn HTML code tags. http://www.w3schools.com/html/default.asp

    Examples:
    http://answers.microsoft.com/en-us/o...c-68b599b31bf5
    http://answers.microsoft.com/en-us/o...f-eb60e6b65aa4
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    kdbailey is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2012
    Posts
    228
    Thanks for the link! Quick question though, how do you just alter the color of one word. It shows how to change the color of an entire paragraph, but I am not seeing where you can change each word separately.

    I keep adjusting this line to try and change the color. I tried using "span" as well, that didn't work. Also tried using "color:darkred", no luck.

    Code:
    parts = parts & "<p><b><font style:" & Chr(34) & "color:#600000" & Chr(34) & ">" & rsclaim.Fields(partfield) & "</font></b> (Quantity: <b>" & rsclaim.Fields(qfield) & "</b>)</p>"
    Last edited by June7; 12-29-2014 at 06:57 PM.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Maybe use = instead of :? I've never seen : used.

    AFAIK, style is a tag, not a property. http://www.w3schools.com/tags/tag_style.asp

    Maybe:

    parts = parts & "<p><b><font " & Chr(34) & "color=#600000" & Chr(34) & ">" & rsclaim.Fields(partfield) & "</font></b> (Quantity: <b>" & rsclaim.Fields(qfield) & "</b>)</p>"
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    kdbailey is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2012
    Posts
    228
    I found that error actually myself, I'm experimenting with other properties now. Thanks for the help!

    This is what is working for me...

    Code:
    parts = parts & "<p><b><font style=" & Chr(34) & "color:#600000" & Chr(34) & ">" & rsclaim.Fields(partfield) & "</font></b> (Quantity: <b><font style=" & Chr(34) & "color:#600000" & Chr(34) & ">" & rsclaim.Fields(qfield) & "</font></b>)</p>"

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 11-27-2013, 08:37 AM
  2. Digital signature
    By NISMOJim in forum Access
    Replies: 2
    Last Post: 02-14-2011, 07:59 PM
  3. Add Signature Box in a form
    By kowsigan in forum Forms
    Replies: 1
    Last Post: 12-20-2010, 03:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums