Results 1 to 4 of 4
  1. #1
    ramirezx@ddmfg.com is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    40

    Send Email via Outlook from an Access form

    Hi,



    I used some code on a form to create and send an email via Outlook 2016, everything works when I use an email address like ramirezx@xyz.com or ramirezx@aol.com in either Email_Send_To or Email_Cc fields on the form. It all works.

    The problem I having is when I use an address that sends a text to a cell phone? If I use the cell # by itself 946338656@mms.att.net in either the Email_Send_To or Email_Cc fields on the form by itself it works. It only fails when I use a combination of both a regular email and a cell # on either he Email_Send_To or Email_Cc fields. It's the combination of these two address that I have the error?

    I hope someone can help?

    ---------------------------------------

    'Send Email and Run Queries

    'Send Email TO
    Email_Send_To = [cbo_NumEmail]
    Email_Cc = [cbo_Notification]

    Email_Body = "Testing 123”
    Email_Subject = "Work Center"

    On Error GoTo debugs

    Set Mail_Object = CreateObject("Outlook.Application")
    Set Mail_Single = Mail_Object.CreateItem(0)

    With Mail_Single
    .Subject = Email_Subject
    .To = Email_Send_To
    .cc = Email_Cc
    .BCC = Email_Bcc
    .Body = Email_Body
    .send
    End With

    debugs:
    If Err.Description <> "" Then MsgBox Err.Description

    ---------------------------------------

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    What exactly does Email_Send_To resolve to?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ramirezx@ddmfg.com is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    40
    The Email_Send_To will pull the data in an unbound text box [cbo_NumEmail] and put the content of that as the email in the To section of the email, same for Email_Cc will put the content from the unbound text box[cbo_Notification] in to the CC: carbon copy section of the email.

    Both work, but only if I use a email address like
    ramirezx@xyz.com or ramirezx@aol.com, or a phone address946338656@mms.att.net by itself.

    It only fails when I have a combination of an email address and a phone address.

    My goal it to send one email TO: a mobile phone via text and CC: to a regular email address. When I put both, I will receive the email, but the mobile phone email in Outlook I will get

    no-reply@mms.att.net

    The email sent failed.

    Thanks!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I'm trying to find out what the variable contains when it fails. I'd expect something like this to work.

    "ramirezx@aol.com; 946338656@mms.att.net"

    If not, do they work if you put the same string directly in an email?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 4
    Last Post: 02-19-2016, 03:13 PM
  2. Replies: 15
    Last Post: 10-17-2015, 07:02 AM
  3. Replies: 3
    Last Post: 11-12-2014, 11:52 AM
  4. Replies: 5
    Last Post: 04-25-2013, 10:36 AM
  5. Send email from Access thru Outlook
    By ZMAN in forum Forms
    Replies: 2
    Last Post: 11-27-2010, 06:10 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