when i am sending mail i am getting an exception "Timed out". How will i solve this ? My code is below.. // To MailMessage sendmail = new MailMessage();
for (int k = 0; k < globaldecl.application1.filecount开发者_开发百科; k++)
{
string fil = attachfile[k];
Attachment data = new Attachment(fil); // Attaching multiples files
sendmail.Attachments.Add(data);
}
sendmail.To.Add(sendfrom);
sendmail.IsBodyHtml = true;
// From
MailAddress mailAddress = new MailAddress(sendfrom, textmessagefromvalue.Text);
sendmail.From = mailAddress;
// Subject and Body
if(textBoxsubject.Text != "")
sendmail.Subject = textBoxsubject.Text;
if(textBoxadcc.Text!="")
sendmail.CC.Add(textBoxadcc.Text);
if(textBoxaddbcc.Text != "")
sendmail.Bcc.Add(textBoxaddbcc.Text);
sendmail.Body = MailText.Text;
sendmail.ReplyTo = mailAddress;
// Init SmtpClient and send
SmtpClient smtpClient = new SmtpClient(sendfromsmtp, sendfromport);
System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(sendfrom,sendfrompassword);
smtpClient.Credentials = credentials;
smtpClient.Send(sendmail);
and i am getting exception "The Operation has Timed Out".
Thanks
精彩评论