Click here to Skip to main content
15,886,519 members
Home / Discussions / ASP.NET
   

ASP.NET

 
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

AnswerRe: mail attachment repeating Pin
whatUrunning.com28-Sep-08 21:34
whatUrunning.com28-Sep-08 21:34 
GeneralRe: mail attachment repeating Pin
kvsreedhar28-Sep-08 21:39
kvsreedhar28-Sep-08 21:39 
GeneralRe: mail attachment repeating Pin
whatUrunning.com28-Sep-08 21:46
whatUrunning.com28-Sep-08 21:46 
GeneralRe: mail attachment repeating Pin
kvsreedhar28-Sep-08 21:58
kvsreedhar28-Sep-08 21:58 
GeneralRe: mail attachment repeating Pin
whatUrunning.com28-Sep-08 22:01
whatUrunning.com28-Sep-08 22:01 
QuestionFailed to compare two elements in the array Pin
soonarai28-Sep-08 21:14
soonarai28-Sep-08 21:14 
Questionhow to attach a word document to asp.net web application using a checkbox control condition wise Pin
sumanth Reddy28-Sep-08 20:19
sumanth Reddy28-Sep-08 20:19 
QuestionHow to create a column contatining textbox control and make it editable in a gridview Pin
sumanth Reddy28-Sep-08 20:04
sumanth Reddy28-Sep-08 20:04 
AnswerRe: How to create a column contatining textbox control and make it editable in a gridview Pin
HemJoshi28-Sep-08 20:46
HemJoshi28-Sep-08 20:46 
QuestionGridview Add to List Field. Pin
Crazy Genius28-Sep-08 19:02
Crazy Genius28-Sep-08 19:02 
QuestionProbleam VB exe run on IIS Pin
Rinki Mukheraji28-Sep-08 18:37
Rinki Mukheraji28-Sep-08 18:37 
AnswerRe: Probleam VB exe run on IIS Pin
HemJoshi28-Sep-08 20:51
HemJoshi28-Sep-08 20:51 
GeneralRe: Probleam VB exe run on IIS Pin
Rinki Mukheraji29-Sep-08 1:46
Rinki Mukheraji29-Sep-08 1:46 
GeneralRe: Probleam VB exe run on IIS Pin
HemJoshi29-Sep-08 2:13
HemJoshi29-Sep-08 2:13 
GeneralRe: Probleam VB exe run on IIS Pin
Rinki Mukheraji29-Sep-08 2:55
Rinki Mukheraji29-Sep-08 2:55 
QuestionGridview problem Pin
kishorg128-Sep-08 18:34
kishorg128-Sep-08 18:34 
AnswerRe: Gridview problem Pin
Steve Echols28-Sep-08 19:32
Steve Echols28-Sep-08 19:32 

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.