Console Program VB.NET

Hello experts,

I have created a vb.net console program (visual studio 2010) that basically takes alert messages from an ms outlook folder and parses the data from the messages in the outlook folder, takes the parsed data and puts in into a csv file and sends the csv file off as an email. The program runs with no issues on my development machine, however when I try and place the .exe on the machine I need to run it on it does not send out the email. I receive the following error in the cmd window.

Unhandled exception: system.argumentsnullexception: Value cannot be null
Parameter name: addresses
at system.net.mail.mailaddresscollection.add(string addresses)
at conelitereorderalerts.modmain.fnmailer(string strattachment)
at con elitereorderalerts.modmain.main

I also tried on another test machine and receive the same error. I get the click here for windows to find a solution but of course nothing happens. Any assistance would be great. Please let me know if I need to provide more detail
tmaususerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lokesh B RDeveloperCommented:
Hi,

NullException: It clearly says that something is NULL,  i.e address

You need add more conditions to check if anything is NULL and write the error in log.
0
tmaususerAuthor Commented:
I agree but don't know what or why. I have everything set identical on my test machine so that is what is puzzling to me. I am not a programmer so it will take me some time to figure out how to write to an error log.
0
Lokesh B RDeveloperCommented:
Hi,

Ahhhh ok.

I think some value is no available in the test machine as it is in the DEV machine.

You can write log file as below.

Log method

public void WriteLog(string message)
{
        using (StreamWriter sWriter = new StreamWriter("D\log.dat", true))
                {
                    using (TextWriter tWriter = TextWriter.Synchronized(sWriter))
                    {
                        ErrorMessage = string.Format("{0:MM/dd/yyy hh:mm:ss.fff tt} :: Application:: - {1}", DateTime.Now, message);
                        tWriter.WriteLine(ErrorMessage);
                    }
                }
}

Open in new window


In Program

if(email != null)
{
    // do the work
}
else
{
    WriteLog("Email is NULL");
}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tmaususerAuthor Commented:
Ok thanks. I will give it a shot and report back
0
glnjalsaCommented:
can anyone give  me program in vb.net console where timer start when program starts and after it ends the timer calculates the time of the program executed like ( a loop starts and ends so start time - endtime)
this time is displayed by the timer
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.