Click here to Skip to main content
15,914,795 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionwebdatetimeedit infragistics control is always displaying in the page (Urgent) Pin
patra.santanu@yahoo.co.in29-Sep-08 0:48
patra.santanu@yahoo.co.in29-Sep-08 0:48 
AnswerRe: webdatetimeedit infragistics control is always displaying in the page (Urgent) Pin
Ashfield29-Sep-08 1:21
Ashfield29-Sep-08 1:21 
QuestionEncryption and Decryption Pin
srinivaskonijeti29-Sep-08 0:40
srinivaskonijeti29-Sep-08 0:40 
AnswerRe: Encryption and Decryption Pin
Ashfield29-Sep-08 1:22
Ashfield29-Sep-08 1:22 
AnswerRe: Encryption and Decryption Pin
Paddy Boyd29-Sep-08 2:23
Paddy Boyd29-Sep-08 2:23 
AnswerRe: Encryption and Decryption Pin
Guffa29-Sep-08 6:13
Guffa29-Sep-08 6:13 
QuestionAuto Fill Grid Pin
srinivaskonijeti29-Sep-08 0:39
srinivaskonijeti29-Sep-08 0:39 
AnswerRe: Auto Fill Grid Pin
HemJoshi29-Sep-08 2:43
HemJoshi29-Sep-08 2:43 
AnswerRe: Auto Fill Grid Pin
ednrg1-Oct-08 3:50
ednrg1-Oct-08 3:50 
QuestionA generic error occurred in GDI+ Pin
mehrdadc4829-Sep-08 0:04
mehrdadc4829-Sep-08 0:04 
QuestionGridview page change is affecting sessions Pin
eyeseetee28-Sep-08 22:44
eyeseetee28-Sep-08 22:44 
AnswerRe: Gridview page change is affecting sessions Pin
simsen29-Sep-08 0:37
simsen29-Sep-08 0:37 
GeneralRe: Gridview page change is affecting sessions Pin
eyeseetee29-Sep-08 0:53
eyeseetee29-Sep-08 0:53 
AnswerRe: Gridview page change is affecting sessions Pin
eyeseetee29-Sep-08 1:18
eyeseetee29-Sep-08 1:18 
Questionhow to get the grid items??? Pin
sarala.s28-Sep-08 22:34
sarala.s28-Sep-08 22:34 
AnswerRe: how to get the grid items??? Pin
whatUrunning.com28-Sep-08 22:47
whatUrunning.com28-Sep-08 22:47 
Questionshow image usin binding problem Pin
sepel28-Sep-08 22:32
sepel28-Sep-08 22:32 
AnswerRe: show image usin binding problem Pin
Ashfield28-Sep-08 23:10
Ashfield28-Sep-08 23:10 
AnswerRe: show image usin binding problem Pin
AlexeiXX329-Sep-08 13:47
AlexeiXX329-Sep-08 13:47 
GeneralRe: show image usin binding problem Pin
sepel29-Sep-08 19:07
sepel29-Sep-08 19:07 
Questionlinkbutton open link Pin
UD(IA)28-Sep-08 22:15
UD(IA)28-Sep-08 22:15 
AnswerRe: linkbutton open link Pin
Ashfield28-Sep-08 23:22
Ashfield28-Sep-08 23:22 
QuestionHow to get System Language? Pin
kindman_nb28-Sep-08 21:27
kindman_nb28-Sep-08 21:27 
AnswerRe: How to get System Language? Pin
whatUrunning.com28-Sep-08 21:42
whatUrunning.com28-Sep-08 21:42 
Questionmail attachment repeating Pin
kvsreedhar28-Sep-08 21:23
kvsreedhar28-Sep-08 21:23 
Please anyone may help!

I am trying a program to send a attachment(only one attachment) to 3 mail recepiants . After sending the mail (a success one) I am finding that the attachment sent to each of the recepient is attached thrice(same file is attached to the mail) whereas I am attaching only a single file.
And more over I am getting the mail twice as if I clicked on the SEND button twice(infact I clicked only once).
Please help me . I give my code as below

Rose | [Rose] thanks in advance Rose | [Rose]

protected void Button1_Click(object sender, EventArgs e)
{
string[] addresses = {"mailaddress1","mailaddress2","mailaddress3" };

SmtpClient smtpMail = new SmtpClient();
smtpMail.Host = "smtp.abc.com";


smtpMail.EnableSsl = true;


MailMessage mail = new MailMessage();

mail.From = new MailAddress("abc@abc.com");

string fileName =
Path.GetFullPath(FileUpload1.PostedFile.FileName);


for (int i = 0; i < addresses.Length; i++)
{


if (FileUpload1.PostedFile != "")
{
try
{
mail.Attachments.Add(new Attachment(fileName));
}

catch (Exception ex)
{
Response.Write(ex.Message);
}

}


mail.To.Add(addresses[i]);
Response.Write(addresses[i] + " ");

mail.Subject = "HAI!!!!!!!";
mail.Body = "ATTACH TO ALL";


smtpMail.Credentials = new System.Net.NetworkCredential(username.Text, txtPassword.Text);

try
{
smtpMail.Send(mail);
Response.Write(" Mail Sent");
}
catch (Exception ex)
{
Response.Write("Error " + ex.InnerException);
Console.WriteLine(ex.InnerException);
}

}
}//end of event click

Kovuru Sreedhar

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.