Results 1 to 4 of 4

Thread: Outlook Interop Mass Email

  1. #1

    Thread Starter
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Outlook Interop Mass Email

    I have an App that does mass emails. It uses a spreadsheet with an email column to accomplish this. It works fine except for...

    After some varying amounts of emails have been sent the Outbox folder starts filling up. The App continues to run until it is done.

    If we go to Outlook and press send/receive nothing happens.
    If we close Outlook and exit without sending it Looks like Outlook has quit, but you can't restart it until you use Task Manager to kill the Outlook Task.

    Upon restarting outlook sends the remainder of the emails.

    What am I doing wrong?
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  2. #2
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,526

    Re: Outlook Interop Mass Email

    You may not actually be doing anything "wrong", at least from your coding perspective. It is possible that your ISP has s limit to the amount of e-mails sent in a given period of time to prevent spammers from getting them on a blacklist. This is assuming that you are sending external emails. If this entirely an internal e-mail system, then there may be an Exchange Server setting that also controls this, or some similar setting if you are using a different system. More details on how Outlook is actually sending the emails would be helpful.

    It is also possible that Outlook is having issues with too many submitted emails at once. A way to test this would be to introduce a variable delay between sending each email. Test with a 10, 30, and 60 second delay to see if the issue goes away.

  3. #3

    Thread Starter
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Outlook Interop Mass Email

    Quote Originally Posted by jdc2000 View Post
    You may not actually be doing anything "wrong", at least from your coding perspective. It is possible that your ISP has s limit to the amount of e-mails sent in a given period of time to prevent spammers from getting them on a blacklist. This is assuming that you are sending external emails. If this entirely an internal e-mail system, then there may be an Exchange Server setting that also controls this, or some similar setting if you are using a different system. More details on how Outlook is actually sending the emails would be helpful.

    It is also possible that Outlook is having issues with too many submitted emails at once. A way to test this would be to introduce a variable delay between sending each email. Test with a 10, 30, and 60 second delay to see if the issue goes away.
    This is internal and there aren't any restrictions that I am aware of.

    It looks like it has something to do with how fast and how many attachments(and size of attachments). I found this bit of code and it seems better, until the attachments get in the 1MB range.

    Code:
            ' Application.DoEvents YUCK - but seems to help OutLook send
            SendRecv()
            For x As Integer = 1 To 3
                Threading.Thread.Sleep(525)
                Application.DoEvents()
            Next
    Code:
        Private oNS As Outlook.NameSpace
        Private oSyncs As Microsoft.Office.Interop.Outlook.SyncObjects
        Private oSync As Microsoft.Office.Interop.Outlook.SyncObject
    
        Private Sub SendRecv()
            Try
                ' Reference SyncObjects.
                oSyncs = oNS.SyncObjects
                oSync = oSyncs.Item("All Accounts")
                ' Send and receive.
                oSync.Start()
            Catch ex As Exception
            End Try
        End Sub
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  4. #4
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,526

    Re: Outlook Interop Mass Email

    Aha - attachments! I did not notice any mention of attachments to the mass emails in your first post. That explains a lot. Each of those attachments has to be uploaded to the mail server before the email can be sent. That is going to take additional time, and could be what is choking the email server. There needs to be a delay for each attachment, and that delay needs to correlate with the size of the attachment. If you attaching five attachments of 5 MB each, that is going to need a significant delay factor before you try sending the next email.

Posting Permissions

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



Click Here to Expand Forum to Full Width