Results 1 to 4 of 4
  1. #1
    cbrsix is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    215

    Sending Email with Delay

    I know you can delay the delivery of emails in ms outlook. Is there a way to establish that in vba through ms access? Below is the email code I am working with now.
    Code:
    Private Sub SendEmail_Click()
    On Error GoTo SendEmail_Err
        Dim myOlApp As Object
        Dim myNameSpace As Object
        Dim myFolder As Object
        Dim myItem As Object
        Dim myAttachments, myRecipient As Object
        Dim recipient As String
        Dim file_name As String
        Dim mySubject As Object
        Dim dbs As Object
        Dim rst As Object
        Dim strSQL As String
        
        strSQL = "SearchEmail" 'Select the Query where you want your information to be drawn from
        Set dbs = CurrentDb
        Set rst = dbs.OpenRecordset(strSQL)
        rst.MoveFirst
        While Not rst.EOF
            recipient = "xxxx@example.com" 'This is the email address that you corresponds to your recipient"
            Set myOlApp = CreateObject("Outlook.Application")
            Set myItem = myOlApp.CreateItem(olMailItem)
            Set myAttachments = myItem.Attachments
            Set myRecipient = myItem.Recipients.Add(recipient)
            myItem.BCC = ssss@example.com 'Enter any other email recipient that you want CC'd for this email
            '"Message Subject String Here"
            myItem.Subject = Me.EmailSubject
            '"Put Message Body Text Here"
            myItem.Body = "Dear Client" & "," & Chr(13) & Chr(10) & Chr(13) & Chr(10) & Me.EmailBody 
            myItem.Display
            rst.MoveNext
        Wend
        DoCmd.Close acForm, "EmailToClients" 'Closes the form
        DoCmd.OpenForm "EmailConfirmation" 'Opens Email Confirmation Form
        Set myRecipient = Nothing
        Set myAttachments = Nothing
        Set myItem = Nothing
        Set myOlApp = Nothing
        Set rst = Nothing
    SendEmail_Exit:
        Exit Sub
    SendEmail_Err:
        MsgBox Err.Description
        Resume SendEmail_Exit
    End Sub


  2. #2
    vincent-leeway is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    36
    Did this work? if not you can try this link, you can find some pointers here, http://www.access-programmers.co.uk/...d.php?t=214813

  3. #3
    stmoong is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2011
    Location
    Singapore
    Posts
    108
    You can use Outlook.MailItem.DeferredDeliveryTime property to do so.

  4. #4
    cbrsix is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    215
    Awesome thanks.

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

Similar Threads

  1. Sending email with an attachment
    By jle0003 in forum Access
    Replies: 3
    Last Post: 12-19-2012, 12:43 PM
  2. sending email through Access
    By crowegreg in forum Import/Export Data
    Replies: 4
    Last Post: 04-15-2012, 03:49 PM
  3. Sending Email via Novell Groupwise
    By jgelpi16 in forum Programming
    Replies: 0
    Last Post: 11-04-2010, 07:24 AM
  4. Email sending
    By Steven.Allman in forum Access
    Replies: 25
    Last Post: 06-21-2010, 09:37 AM
  5. Sending email
    By nashr1928 in forum Reports
    Replies: 8
    Last Post: 04-27-2010, 11:14 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