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. C#
  4. Reg: Repeating Mail id's in to Address while sending mails

Reg: Repeating Mail id's in to Address while sending mails

Scheduled Pinned Locked Moved C#
csharpcomdata-structurestestingbeta-testing
2 Posts 2 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.
  • S Offline
    S Offline
    Satish Developer
    wrote on last edited by
    #1

    HI, I am sending mails by getting mailid's from arraylist. but after sending a mail, when i open it the to-address is appending with next id's the code is as follows. Can any one help for this? I tried CC also. but not use. I used ASP mail componenet MailSender objMailSender = new MailSender(); objMailSender.Host = "mail.domain.com"; objMailSender.Username = "uname"; objMailSender.Password = "pwd"; string strQueuePath = "C:\\Program Files\\Persits Software\\AspEmail\\Queue"; string Fromaddr = txtFromAddr.Text.ToString(); for (int i = start; i <= end; i++) { _mailId = ""; _mailId = Convert.ToString(Mailidary[i]); if (_mailId != "") { objMailSender.AddAddress(_mailId, objMailSender); objMailSender.From = Fromaddr; objMailSender.FromName = "Techgene.net"; objMailSender.Subject = Convert.ToString(txtSubject.Text); objMailSender.Body = Convert.ToString(txtBody.Text); objMailSender.IsHTML = 1; objMailSender.SendToQueue(strQueuePath); } } For TEsting i took 10 mailid's(same) in to arraylist. After getting mail, the to address look like this......... To: satish.g@techgene.com; satish.g@techgene.com; satish.g@techgene.com; G. Satish

    D 1 Reply Last reply
    0
    • S Satish Developer

      HI, I am sending mails by getting mailid's from arraylist. but after sending a mail, when i open it the to-address is appending with next id's the code is as follows. Can any one help for this? I tried CC also. but not use. I used ASP mail componenet MailSender objMailSender = new MailSender(); objMailSender.Host = "mail.domain.com"; objMailSender.Username = "uname"; objMailSender.Password = "pwd"; string strQueuePath = "C:\\Program Files\\Persits Software\\AspEmail\\Queue"; string Fromaddr = txtFromAddr.Text.ToString(); for (int i = start; i <= end; i++) { _mailId = ""; _mailId = Convert.ToString(Mailidary[i]); if (_mailId != "") { objMailSender.AddAddress(_mailId, objMailSender); objMailSender.From = Fromaddr; objMailSender.FromName = "Techgene.net"; objMailSender.Subject = Convert.ToString(txtSubject.Text); objMailSender.Body = Convert.ToString(txtBody.Text); objMailSender.IsHTML = 1; objMailSender.SendToQueue(strQueuePath); } } For TEsting i took 10 mailid's(same) in to arraylist. After getting mail, the to address look like this......... To: satish.g@techgene.com; satish.g@techgene.com; satish.g@techgene.com; G. Satish

      D Offline
      D Offline
      duncanmhor
      wrote on last edited by
      #2

      Looks like you are continuously adding the address to the objmailsender object. Try moving your declarations into the for loop, this will create a new object for each mail, and therefore not store the previous address.

      "You're very clever, young man, very clever," said the old lady. "But it's turtles all the way down!"

      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