Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Mail Madness
Message
From
05/12/2011 15:42:32
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Mail Madness
Miscellaneous
Thread ID:
01530383
Message ID:
01530383
Views:
106
The following code, run in a console app, gives me 5 email messages to the same address every time I run it.

I should be getting 1 message.

Why am I gettting 5?


HELPPPP!!!!!!!!
namespace VSAlert
{
  class Program
  {

    static void Main(string[] args)
    {
      string PDFPath1 = ConfigurationManager.AppSettings["PDFPATH1"];
      int MailDelay = Convert.ToInt32(ConfigurationManager.AppSettings["MailDelay"]);
      AppUtilities appUtilities = new AppUtilities();
      DirectoryInfo sourcepdfdir1 = new DirectoryInfo(@PDFPath1);
      WSGUtilities wsgUtilities = new WSGUtilities("VS Alert");
      SqlConnection conn = new SqlConnection();
      AppConstants myAppconstants = new AppConstants();
      System.Net.Mail.MailMessage alertMessage = new System.Net.Mail.MailMessage();
      alertMessage.From = new System.Net.Mail.MailAddress(appUtilities.SMTPFrom);
      alertMessage.To.Clear();
      alertMessage.To.Add("wfitz@woodsysgrp.com");
      alertMessage.Body = DateTime.Now.ToString();
      System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient(appUtilities.SMTPServer, 25);
      smtp.Credentials = new NetworkCredential(appUtilities.SMTPUser,
       appUtilities.SMTPPassword);
      smtp.Send(alertMessage);
     // VSAltertMethods vsAlert = new VSAltertMethods();
     // vsAlert.dosomething();
    }

  } // Program
Anyone who does not go overboard- deserves to.
Malcolm Forbes, Sr.
Next
Reply
Map
View

Click here to load this message in the networking platform