Results 1 to 11 of 11
  1. #1
    Join Date
    Sep 2008
    Posts
    150

    Unanswered: How do you add static email address in email code?

    Hello,

    Wondering if someone can tell me how to add a static email address to the following code? Although the email submits with no errors, I do not receive the actual notification email.

    What am I doing wrong?

    Private Sub Send_Button_Click()

    Dim strEmail As String, _
    strSubject As String, _
    strMessage As String

    strEmail = "ml@aol.com"
    strSubject = "Customer Service Survey Form"
    strMessage = "ml@aol.com" & "," & vbNewLine & vbNewLine & _
    "This is an automated email to notify you that the following
    Customer Service Survey has been submitted." & vbNewLine &
    vbNewLine & _
    "Survey No.: Survey No." & Me.Survey_Number & vbNewLine & _
    "What did you like best about our customer service?: " &
    Me.staff_recommendation & vbNewLine & ""

    On Error Resume Next
    DoCmd.SendObject acSendNoObject, , , strEmail, , , strSubject,
    strMessage, False

    End Sub
    <END CODE>

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Type it?

    I don't understand the question. You said it sends with no errors. So what's the problem?
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Sep 2008
    Posts
    150
    Sorry StarTrekker,

    Yes, it seems to send okay (no errors), but I do not receive an email to the email address I have in the code (ml@aol.com). I should receive an email notification with the data I have in the strMessage section.

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    So in other words, the code runs with no errors, but no mail is sent?

    Does anything appear in the Outbox? What about Sent Items?

    Get rid of the On Error Resume Next line just before sending. Perhaps that will make the system display the error that is stopping the command from working!

    Code:
    Private Sub Send_Button_Click()
      Dim strEmail As String, strSubject As String, strMessage As String
    
      strEmail = "ml@aol.com"
      strSubject = "Customer Service Survey Form"
      strMessage = strEmail & "," & vbNewLine & vbNewLine & _
           "This is an automated email to notify you that the following Customer Service Survey has been submitted." & vbNewLine & vbNewLine & _
           "Survey No.: " & Me.Survey_Number & vbNewLine & vbNewLine & _
           "What did you like best about our customer service?: " & _
           Me.staff_recommendation & vbNewLine
      DoCmd.SendObject acSendNoObject, , , strEmail, , , strSubject, strMessage, False
    End Sub
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  5. #5
    Join Date
    Sep 2008
    Posts
    150
    Hi StarTrekker,

    Your suggestion and code worked. Thanks for your help.

  6. #6
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    You're welcome
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  7. #7
    Join Date
    Sep 2008
    Posts
    150
    Hello StarTrekker,

    If you don't mind, I have a question. Is this the best way to send multiple emails. I may receive emails to two of the email boxes, but not all. I am wondering if I am doing the "strEmail" correctly.


    Dim strEmail As String, strSubject As String, strMessage As String

    strEmail = "ivan@gmail.com"
    strEmail = "Lampson@yahoo.com"
    strEmail = "ml@aol.com"
    strSubject = "Customer Service Survey Form"
    strMessage = "Hello" & "," & vbNewLine & vbNewLine & _
    "This is an automated email to notify you that the following Customer Service Survey has been submitted." & vbNewLine & vbNewLine & vbNewLine & _
    "Survey Number: CSS" & Me.Survey_Number & vbNewLine & vbNewLine & ""

  8. #8
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    No. That would send to ml@aol.com only.

    Please tell me that you're not going to become another annoying e-mail spamm0r??!!
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  9. #9
    Join Date
    Sep 2008
    Posts
    150
    LOL! No I'm not. I figured it out and all is working well.

    I do appreciate your responses. Thanks again.

  10. #10
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    You're most welcome and very glad to hear it! ^^
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  11. #11
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    one thing to learn from this is the art or skills of where and when to put a debug breakpoint or msg box
    examining the value of strEmail would have told you what was or wasn't happening far quicker

    Code:
    strEmail = "ivan@gmail.com"
    strEmail = "Lampson@yahoo.com"
    strEmail = "ml@aol.com"
    msgbox ("Recipients are:" & strEmail,vbInfo)
    strSubject = "Customer Service Survey Form"
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •