Results 1 to 8 of 8
  1. #1
    2 Star Lounger
    Join Date
    Apr 2002
    Location
    Evansville, Indiana, USA
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Send Email (2003)

    Is there a built in mailto function in VBA? I want to send an email to a user when a button is clicked.
    Thanks,

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Send Email (2003)

    You can use DoCmd.SendObject. You can attach a database object (table, query, report) to the e-mail if you wish.

    Here is an example of sending an e-mail without an attachment:
    <code>
    DoCmd.SendObject To:="you@company.com", Subject:="Invoice", _
    MessageText:="Please pay $100" & vbCrLf & "BZimmer", EditMessage:=True
    </code>
    The e-mail will be displayed so that you can edit it before sending it. If you want to send it without intervention, use <code>EditMessage:=False</code>

    If you type SendObject in the Visual Basic Editor and press F1, you'll get help about it.

  3. #3
    2 Star Lounger
    Join Date
    Apr 2002
    Location
    Evansville, Indiana, USA
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Send Email (2003)

    This creates an email, but it puts it in my outbox. It does not actually send the message. Even when I press send/receive in outlook, the message doesn't send. I have to open the message and then select send. Is there a way to automate this?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Send Email (2003)

    I'm afraid that's a problem on your side. When I use this at work (with Outlook on Exchange Server), the message is sent immediately. When I use it at home (stand-alone Outlook), the message remains in the Outbox until the next scheduled Send/Receive (or until I click Send/Receive), then it's sent and a copy is stored in the Sent Items folder.
    Could it be a security problem - perhaps an antivirus program blocking it?

  5. #5
    2 Star Lounger
    Join Date
    Apr 2002
    Location
    Evansville, Indiana, USA
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Send Email (2003)

    I believe it is a security problem with Vista. From my xp box, it worked fine. Instead of hard coding the to address, I would like to make it dynamic. I have a employee table with First and Last name as two separate fileds. Is there a way to genearate a user name base off the first letter of the first name and their last name?

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Send Email (2003)

    Do you want to send an e-mail to everyone in the table, or to the person in the current record on a form?
    And if you want to send to everyone, do you want an individual e-mail to each person, or one e-mail to all of them?

  7. #7
    2 Star Lounger
    Join Date
    Apr 2002
    Location
    Evansville, Indiana, USA
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Send Email (2003)

    I figured it out. I used the left() method to get the first letter of their name. I want it to go to just one person. I am trying to sent it to someone else as a copy. Is that possible? I got it to send it to two people, but I would like it to be sent as a CC instead of a TO:.

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Send Email (2003)

    Yes, you can add a CC (and if desired also a BCC) address:
    <code>
    DoCmd.SendObject ..., CC:="someone.else@other.com"
    </code>
    (See the help for SendObject in Access)

Posting Permissions

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