Reg: Repeating Mail id's in to Address while sending mails
-
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
-
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
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!"