How to make cdo.Message throw an exception if invalid email address is entered.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • billiy321
    New Member
    • Feb 2010
    • 4

    How to make cdo.Message throw an exception if invalid email address is entered.

    Hi

    I am trying to send a mail in C# without having to use an SMTP server(using SMTP service instead) with " cdoSendUsingPic kup " configuration. But when i enter a invalid recipient adderss say blablabla@crap. com.au, only moves the mail into the folder "C:\Inetpub\mai lroot\Drop" but doesnt throw an exception. What i want to be able to do is if something like this happens it should throw an exception or alert saying mail has not been sent due to bla bla bla reason. Any suggestions

    cheers
  • alexis4
    New Member
    • Dec 2009
    • 113

    #2
    Originally posted by billiy321
    if something like this happens it should throw an exception or alert saying mail has not been sent due to bla bla bla reason
    There are ways to create and throw your own exception, but a simple try-catch won't do?

    Comment

    • billiy321
      New Member
      • Feb 2010
      • 4

      #3
      Originally posted by alexis4
      There are ways to create and throw your own exception, but a simple try-catch won't do?
      Hey thnx for replying.
      Na simple try-catch wont do coz if i enter some invalid email id, the SMTP service just moves that mail into a special folder and doesnt throw any exception...and I've actually just thought of a better way to put my question. I want a delivery status notification(se nt or failed) in C# when i am using the below code

      CDO.Message mail = new CDO.Message();
      CDO.IConfigurat ion iConfg = mail.Configurat ion;
      ADODB.Fields oFields = iConfg.Fields;


      ADODB.Field oField =oFields["http://schemas.microso ft.com/cdo/configuration/sendusing"];

      oField.Value = 1;(which means send using pickup directory not smtp server port etc etc)

      oFields.Update( );

      Comment

      • tlhintoq
        Recognized Expert Specialist
        • Mar 2008
        • 3532

        #4
        SMTP service just moves that mail into a special folder
        How about using a FileSystemWatch er to keep an eye on that special folder. Then you can parse any new messages that show up

        Comment

        • billiy321
          New Member
          • Feb 2010
          • 4

          #5
          Yea thats exactly what i had thought but the problem is A: Its in a stupid format(.eml) and B: The data inside is not consistent so cant really pic it up and parse whats within.....Gues s theres no usefull way how bizarre. My BA wants me to make this stupid C# application, send emails without using our SMTP server. And only way i could do it is by using the IIS SMTP Service but seems thats not too useful either:(:(:(

          Comment

          • tlhintoq
            Recognized Expert Specialist
            • Mar 2008
            • 3532

            #6
            You give up way too easily. Do you really think you're the first person who needed to parse and email file? Google dude. "C# parse .eml"

            The home for technical questions and answers at Microsoft. Get started asking, answering, and browsing questions about products like .Net, Azure, or Teams.


            The email format (.eml) is pretty common.

            Comment

            Working...