Results 1 to 3 of 3
  1. #1
    Gina Maylone is offline Always learning
    Windows 7 64bit Access 2013
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    458

    Gmail signature with email address syntax error

    Hello all!



    I have a function that emails an update status to a client, I was successfully able to get the company name and address into HTML format, however, I cannot get the employees' email address into HTML format at the end of the email. I keep getting a syntax error. I am trying to pull the employee's email from the form (which works fine in the top section)

    Code:
    If IsNull(Me.UserEmail) Then
    MsgBox "Please enter your email address"
    Me.UserEmail.SetFocus
    Exit Sub
    End If
    On Error GoTo errHandler
    Const cdoSendUsingPickup = 1
    Const cdoSendUsingPort = 2
    Const cdoAnonymous = 0
    Const cdoBasic = 1
    Const cdoNTLM = 2
    Set omail = CreateObject("CDO.Message")
    omail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/con...tion/sendusing") = 2
    omail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/con...ion/smtpserver") = "smtp.gmail.com"
    omail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/con...tpauthenticate") = cdoBasic
    omail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/con...n/sendusername") = Me.UserEmail
    omail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/con...n/sendpassword") = Me.password
    omail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/con...smtpserverport") = 465
    omail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/con...ion/smtpusessl") = True
    omail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/con...nectiontimeout") = 60
    omail.From = Me.UserEmail
    omail.To = Me.invoiceemail
    omail.BCC = ""
    omail.Subject = Me.EmailSubject
    
    omail.HTMLBody = "<font size='2' face='Verdana, Arial, Helvetica, sans-serif'>"
    omail.HTMLBody = Forms!mainprocessentry!COMMENTS
    omail.HTMLBody = omail.HTMLBody & "<font face=""Comic Sans MS"" size=""3"" color=""blue""><b>CompanyName</b></font><BR>"
    omail.HTMLBody = omail.HTMLBody & "<font face=""Times New Roman"" size=""2"" color=""blue""><i>Address</font><BR>"
    omail.HTMLBody = omail.HTMLBody & "<font face=""Times New Roman"" size=""2"" color=""blue""><i>Ellisville, MS 39437</font><BR>"
    omail.HTMLBody = omail.HTMLBody & "<font face=""Times New Roman"" size=""2"" color=""blue""><i>(555)555-1212office</font><BR>"
    omail.HTMLBody = omail.HTMLBody & "<font face=""Times New Roman"" size=""2"" color=""blue""><i>(555)555-1313 fax</font><BR>"
    omail.HTMLBody = omail.HTMLBody & "<a href=mailto: "Me.UserEmail"
                                   
    
    omail.Configuration.Fields.Update
    omail.Send
    MsgBox "Status Update Sent"
    Set omail = Nothing
    Set oMailConfig = Nothing
     Exit Sub
    errHandler:
        MsgBox "Error " & Err.Number & ": " & Err.Description & " in " & _
               VBE.ActiveCodePane.CodeModule, vbOKOnly, "Error"
    End Sub
    TIA!

  2. #2
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,608
    I think the address itself should be in quotes. Try:

    omail.HTMLBody = omail.HTMLBody & "<a href=mailto: """" & Me.UserEmail & """"

  3. #3
    Gina Maylone is offline Always learning
    Windows 7 64bit Access 2013
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    458
    I figured it out using the KISS theory.
    Code:
    omail.HTMLBody = omail.HTMLBody & Me.UserEmail

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

Similar Threads

  1. Add Outlook Signature to Email - CODE
    By floyd in forum Programming
    Replies: 1
    Last Post: 11-27-2013, 09:23 AM
  2. Replies: 7
    Last Post: 11-27-2013, 08:37 AM
  3. Replies: 5
    Last Post: 11-26-2013, 11:21 AM
  4. Send email error and double up address
    By burrina in forum Forms
    Replies: 6
    Last Post: 01-21-2013, 03:49 PM
  5. sending gmail email through access
    By TheShabz in forum Programming
    Replies: 20
    Last Post: 02-19-2012, 12:24 PM

Tags for this Thread

Posting Permissions

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