Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Email Program [modified]

Email Program [modified]

Scheduled Pinned Locked Moved Visual Basic
help
15 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    Uma Kameswari
    wrote on last edited by
    #1

    Hi, I have a program written in VB 6.0 for sending automated mails using CDO object. Suddenly it stopped working. I am giving the code below. What could be the possible reason for this program to stop working suddenly.

    Public Sub SendOutlookMail(Subject As String, Recipient As String, Sender as String, strHTML As String)
    Dim iMsg As New CDO.Message

    On Error GoTo ErrHdlr
    Const cdoSendUsingPort = 2
    
    ' Apply the settings to the message.
    With iMsg
        .To = Recipient   'Recipient 'Recipient 'ToDo: Enter a valid email address.
        .From = Sender
        .Subject = Subject
        .HTMLBody = strHTML
        .Send
    End With
    
    ' Clean up variables.
    Set iMsg = Nothing
    Exit Sub
    

    ErrHdlr:
    Exit Sub
    End Sub

    Regards, Uma

    modified on Tuesday, June 7, 2011 8:33 AM

    T 1 Reply Last reply
    0
    • U Uma Kameswari

      Hi, I have a program written in VB 6.0 for sending automated mails using CDO object. Suddenly it stopped working. I am giving the code below. What could be the possible reason for this program to stop working suddenly.

      Public Sub SendOutlookMail(Subject As String, Recipient As String, Sender as String, strHTML As String)
      Dim iMsg As New CDO.Message

      On Error GoTo ErrHdlr
      Const cdoSendUsingPort = 2
      
      ' Apply the settings to the message.
      With iMsg
          .To = Recipient   'Recipient 'Recipient 'ToDo: Enter a valid email address.
          .From = Sender
          .Subject = Subject
          .HTMLBody = strHTML
          .Send
      End With
      
      ' Clean up variables.
      Set iMsg = Nothing
      Exit Sub
      

      ErrHdlr:
      Exit Sub
      End Sub

      Regards, Uma

      modified on Tuesday, June 7, 2011 8:33 AM

      T Offline
      T Offline
      thatraja
      wrote on last edited by
      #2

      Uma Kameswari wrote:

      Suddenly it stopped working

      Include the error message in your question. BTW format the code using Code block in the question

      thatraja


      **My Tip/Tricks
      My Dad had a Heart Attack on this day so don't...
      **

      U 1 Reply Last reply
      0
      • T thatraja

        Uma Kameswari wrote:

        Suddenly it stopped working

        Include the error message in your question. BTW format the code using Code block in the question

        thatraja


        **My Tip/Tricks
        My Dad had a Heart Attack on this day so don't...
        **

        U Offline
        U Offline
        Uma Kameswari
        wrote on last edited by
        #3

        No error message. When I execute the program with break points it is not throwing any error. it is executing successfully. but mails are not received.

        L 1 Reply Last reply
        0
        • U Uma Kameswari

          No error message. When I execute the program with break points it is not throwing any error. it is executing successfully. but mails are not received.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          I notice that when you catch any error you merely exit from the subroutine. This is extremely bad practice as it means you just eat any exception that occurs rather than using the information provided to diagnose why your code is failing.

          The best things in life are not things.

          U 1 Reply Last reply
          0
          • L Lost User

            I notice that when you catch any error you merely exit from the subroutine. This is extremely bad practice as it means you just eat any exception that occurs rather than using the information provided to diagnose why your code is failing.

            The best things in life are not things.

            U Offline
            U Offline
            Uma Kameswari
            wrote on last edited by
            #5

            As I already said I traced the code it is not throwing any exception. The best practice is to write a logfile. I agree with you.

            L 1 Reply Last reply
            0
            • U Uma Kameswari

              As I already said I traced the code it is not throwing any exception. The best practice is to write a logfile. I agree with you.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Check your CDO configuration values as described here[^]. Also in the following line:

              Const cdoSendUsingPort = 2
              

              the variable is never referenced in your code, why is it there?

              The best things in life are not things.

              U 1 Reply Last reply
              0
              • L Lost User

                Check your CDO configuration values as described here[^]. Also in the following line:

                Const cdoSendUsingPort = 2
                

                the variable is never referenced in your code, why is it there?

                The best things in life are not things.

                U Offline
                U Offline
                Uma Kameswari
                wrote on last edited by
                #7

                this is a code written 8 yrs back by another user. As it was working we did not review it. Now what is the reason for the mails not getting delivered suddenly. till last tuesday it was working fine and suddenly it stopped working.

                L J 2 Replies Last reply
                0
                • U Uma Kameswari

                  this is a code written 8 yrs back by another user. As it was working we did not review it. Now what is the reason for the mails not getting delivered suddenly. till last tuesday it was working fine and suddenly it stopped working.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  Something must have changed, but it is impossible to determine the problem without being able to access your system and run it through the debugger. So, I guess it's up to you.

                  The best things in life are not things.

                  1 Reply Last reply
                  0
                  • U Uma Kameswari

                    this is a code written 8 yrs back by another user. As it was working we did not review it. Now what is the reason for the mails not getting delivered suddenly. till last tuesday it was working fine and suddenly it stopped working.

                    J Offline
                    J Offline
                    Johan Hakkesteegt
                    wrote on last edited by
                    #9

                    Is it always (mainly) the same message to the same address ? If your code is not throwing any errors, the most likely reason for the message not arriving is not your code. You should test the app by adding your own address to the BCC field, and see if you receive the message. And/or you may want to look into the following things: 1. the recipient's address has changed or has been deleted, and your app is sending the message to the old address. 2. the recipient's email program has interpreted the message as being SPAM, and is now blocking it. 3. the recipient's email operator uses a (new) SPAM blocking service, which has interpreted your messages as SPAM and is now blocking them. 4. the mail server you send messages through has changed (new server ?)

                    My advice is free, and you may get what you paid for.

                    U 1 Reply Last reply
                    0
                    • J Johan Hakkesteegt

                      Is it always (mainly) the same message to the same address ? If your code is not throwing any errors, the most likely reason for the message not arriving is not your code. You should test the app by adding your own address to the BCC field, and see if you receive the message. And/or you may want to look into the following things: 1. the recipient's address has changed or has been deleted, and your app is sending the message to the old address. 2. the recipient's email program has interpreted the message as being SPAM, and is now blocking it. 3. the recipient's email operator uses a (new) SPAM blocking service, which has interpreted your messages as SPAM and is now blocking them. 4. the mail server you send messages through has changed (new server ?)

                      My advice is free, and you may get what you paid for.

                      U Offline
                      U Offline
                      Uma Kameswari
                      wrote on last edited by
                      #10

                      It is not the same message but it is a report in the same format. and to the same address. I just now tried by including my address in BCC but still I did not receive the mail. The mail server has changed 2 months before. Even after changing the mail server the program was sending mails properly and suddenly 1 fine day it stopped sending mails. Subject is same to the mail and also the sender address is same. So if suppose it is identified as SPAM by the server how can we resolve this. As the program is not generating any error logically it seems to be a problem at mail server level. How to resolve this?

                      J 1 Reply Last reply
                      0
                      • U Uma Kameswari

                        It is not the same message but it is a report in the same format. and to the same address. I just now tried by including my address in BCC but still I did not receive the mail. The mail server has changed 2 months before. Even after changing the mail server the program was sending mails properly and suddenly 1 fine day it stopped sending mails. Subject is same to the mail and also the sender address is same. So if suppose it is identified as SPAM by the server how can we resolve this. As the program is not generating any error logically it seems to be a problem at mail server level. How to resolve this?

                        J Offline
                        J Offline
                        Johan Hakkesteegt
                        wrote on last edited by
                        #11

                        The first thing you could try is to manually create a similar message in your regular email client (same recipients including yourself, same subject, same body text, same attachments). See if that message does arrive. Another thing you could check is the Sender address (the From field). Does this address exist ? If the manual message did arrive, was the sender address the same as the one used by your code ?

                        My advice is free, and you may get what you paid for.

                        U 2 Replies Last reply
                        0
                        • J Johan Hakkesteegt

                          The first thing you could try is to manually create a similar message in your regular email client (same recipients including yourself, same subject, same body text, same attachments). See if that message does arrive. Another thing you could check is the Sender address (the From field). Does this address exist ? If the manual message did arrive, was the sender address the same as the one used by your code ?

                          My advice is free, and you may get what you paid for.

                          U Offline
                          U Offline
                          Uma Kameswari
                          wrote on last edited by
                          #12

                          Manually I am sending the similar message from my outlook account and the message is arriving. Sender address exists.

                          1 Reply Last reply
                          0
                          • J Johan Hakkesteegt

                            The first thing you could try is to manually create a similar message in your regular email client (same recipients including yourself, same subject, same body text, same attachments). See if that message does arrive. Another thing you could check is the Sender address (the From field). Does this address exist ? If the manual message did arrive, was the sender address the same as the one used by your code ?

                            My advice is free, and you may get what you paid for.

                            U Offline
                            U Offline
                            Uma Kameswari
                            wrote on last edited by
                            #13

                            We are using MS Exchange Server ver 10. Has it got something to do with authentication. If so how to set it using CDOObject?

                            J 1 Reply Last reply
                            0
                            • U Uma Kameswari

                              We are using MS Exchange Server ver 10. Has it got something to do with authentication. If so how to set it using CDOObject?

                              J Offline
                              J Offline
                              Johan Hakkesteegt
                              wrote on last edited by
                              #14

                              One last thing to check: on the last day the message was sent successfully, or on the first day the message was no longer received, were there any Windows, MS Exchange, or MS Office updates installed on the sending server ? If so, you can try uninstalling any or all of these updates. I am afraid that after that I am running out of ideas and I have no experience with CDO, and all similar code that I have ever written is in VB.NET. So the only other thing I can think of is to rewrite the app in .Net so you can get better feedback on the reason why the message is not arriving. .Net can give feedback on the Send method, so you can find out what the smtp server is saying about the message. Good luck, Johan

                              My advice is free, and you may get what you paid for.

                              U 1 Reply Last reply
                              0
                              • J Johan Hakkesteegt

                                One last thing to check: on the last day the message was sent successfully, or on the first day the message was no longer received, were there any Windows, MS Exchange, or MS Office updates installed on the sending server ? If so, you can try uninstalling any or all of these updates. I am afraid that after that I am running out of ideas and I have no experience with CDO, and all similar code that I have ever written is in VB.NET. So the only other thing I can think of is to rewrite the app in .Net so you can get better feedback on the reason why the message is not arriving. .Net can give feedback on the Send method, so you can find out what the smtp server is saying about the message. Good luck, Johan

                                My advice is free, and you may get what you paid for.

                                U Offline
                                U Offline
                                Uma Kameswari
                                wrote on last edited by
                                #15

                                Even we thought the same and written a program in .NET which is working fine. Thank you for all you advices. Regards, Uma

                                1 Reply Last reply
                                0
                                Reply
                                • Reply as topic
                                Log in to reply
                                • Oldest to Newest
                                • Newest to Oldest
                                • Most Votes


                                • Login

                                • Don't have an account? Register

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • World
                                • Users
                                • Groups